def update_encrypted_private_key(self, private_key_secret_ref): pem = keys.get_encrypted_private_key_pem() update_resp = self.secret_behaviors.update_secret_payload( private_key_secret_ref, pem, 'application/octet-stream') self.assertEqual(204, update_resp.status_code)
def store_encrypted_private_key(self): pem = keys.get_encrypted_private_key_pem() test_model = secret_models.SecretModel( **get_private_key_req(base64.b64encode(pem))) resp, private_key_secret_ref = self.secret_behaviors.create_secret( test_model) self.assertEqual(201, resp.status_code) return private_key_secret_ref
def verify_container_keys_equal(self, secret_dict, with_passphrase=False): if with_passphrase: passphrase = keys.get_passphrase_txt() self.assertEqual(passphrase, secret_dict['private_key_passphrase']) private_pem = keys.get_encrypted_private_key_pem() else: self.assertFalse('private_key_passphrase' in secret_dict) private_pem = keys.get_private_key_pem() self.assertEqual(private_pem, secret_dict['private_key']) public_pem = keys.get_public_key_pem() self.assertEqual(public_pem, secret_dict['public_key'])
def test_rsa_check_input_keys(self): """Verify the input keys for test cases""" # prove pyOpenSSL can parse the original private key pem = keys.get_private_key_pem() crypto.load_privatekey(crypto.FILETYPE_PEM, pem) # prove pyCrypto can parse the original public key pem = keys.get_public_key_pem() RSA.importKey(pem) # prove pyOpenSSL can parse the original encrypted private key pem = keys.get_encrypted_private_key_pem() passphrase = keys.get_passphrase_txt() crypto.load_privatekey(crypto.FILETYPE_PEM, pem, passphrase) # prove OpenSSL can parse the original certificate pem = keys.get_certificate_pem() crypto.load_certificate(crypto.FILETYPE_PEM, pem)
def test_rsa_check_input_keys(self): """Verify the input keys for test cases""" # prove pyOpenSSL can parse the original private key pem = keys.get_private_key_pem() crypto.load_privatekey(crypto.FILETYPE_PEM, pem) # prove cryptography can parse the original public key serialization.load_pem_public_key(keys.get_public_key_pem(), backend=default_backend()) # prove pyOpenSSL can parse the original encrypted private key pem = keys.get_encrypted_private_key_pem() passphrase = keys.get_passphrase_txt() crypto.load_privatekey(crypto.FILETYPE_PEM, pem, passphrase) # prove OpenSSL can parse the original certificate pem = keys.get_certificate_pem() crypto.load_certificate(crypto.FILETYPE_PEM, pem)
def test_rsa_check_input_keys(self): """Verify the input keys for test cases""" # prove pyOpenSSL can parse the original private key pem = keys.get_private_key_pem() crypto.load_privatekey(crypto.FILETYPE_PEM, pem) # prove cryptography can parse the original public key serialization.load_pem_public_key( keys.get_public_key_pem(), backend=default_backend() ) # prove pyOpenSSL can parse the original encrypted private key pem = keys.get_encrypted_private_key_pem() passphrase = keys.get_passphrase_txt() crypto.load_privatekey(crypto.FILETYPE_PEM, pem, passphrase) # prove OpenSSL can parse the original certificate pem = keys.get_certificate_pem() crypto.load_certificate(crypto.FILETYPE_PEM, pem)
def verify_encrypted_private_key_equal(self, retrieved_private_key): pem = keys.get_encrypted_private_key_pem() self.assertEqual(pem, retrieved_private_key)