@@ -63,7 +63,7 @@ def setUp(self):
6363
6464        # assign intermediate CA private key and CA chain to Conjur variables 
6565        ca_chain  =  read_file (CERT_CHAIN_PATH )
66-         private_key  =  read_file (INTERMED_PRIVKEY_PATH )
66+         private_key  =  read_file (UNENCRYPTED_KEY_PATH )
6767
6868        self .secrets_api  =  openapi_client .SecretsApi (self .client )
6969        self .configure_ca (ca_chain , private_key , None )
@@ -135,6 +135,46 @@ def test_sign_201_pem(self):
135135        self .assertEqual (status , 201 )
136136        self .assertIsInstance (response , str )
137137
138+     def  test_sign_with_encrypted_key_201 (self ):
139+         """Test case for 201 response when requesting a signed certificate 
140+         Uses an encrypted intermediate key and password to sign CSR 
141+         """ 
142+         key_password  =  read_file (KEY_PASSWORD_PATH )
143+         encrypted_key  =  read_file (ENCRYPTED_KEY_PATH )
144+ 
145+         self .configure_ca (None , encrypted_key , key_password )
146+ 
147+         response , status , _  =  self .api .sign_with_http_info (
148+             self .account ,
149+             self .CA_SERVICE_ID ,
150+             self .csr ,
151+             'P1D' 
152+         )
153+ 
154+         self .assertEqual (status , 201 )
155+         self .assertIsInstance (response , openapi_client .models .certificate_json .CertificateJson )
156+ 
157+         self .assertEqual (response .certificate [:27 ], '-----BEGIN CERTIFICATE-----' )
158+ 
159+     def  test_sign_with_encrypted_key_500 (self ):
160+         """Test case for 500 response when requesting a signed certificate 
161+         500 status repsonses can result from a misconfigured CA service 
162+         In this test, the Conjur variable for the encrypted key's password is incorrect 
163+         """ 
164+         encrypted_key  =  read_file (ENCRYPTED_KEY_PATH )
165+ 
166+         self .configure_ca (None , encrypted_key , 'wrong_pass' )
167+ 
168+         with  self .assertRaises (openapi_client .ApiException ) as  context :
169+             self .api .sign (
170+                 self .account ,
171+                 self .CA_SERVICE_ID ,
172+                 self .csr ,
173+                 'P1D' 
174+             )
175+ 
176+         self .assertEqual (context .exception .status , 500 )
177+ 
138178    def  test_sign_400 (self ):
139179        """Test case for 400 response when requesting a signed certificate 
140180        Error originates from NGINX, occurs when making HTTPS requests to Conjur through NGINX 
0 commit comments