def store_passphrase(self): passphrase = keys.get_passphrase_txt() test_model = secret_models.SecretModel( **get_passphrase_req(passphrase)) resp, passphrase_secret_ref = self.secret_behaviors.create_secret( test_model) self.assertEqual(201, resp.status_code) return passphrase_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_passphrase_equal(self, retrieved_passphrase): passphrase = keys.get_passphrase_txt() self.assertEqual(passphrase, retrieved_passphrase)