예제 #1
0
 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)
예제 #2
0
 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
예제 #3
0
 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'])
예제 #4
0
 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'])
예제 #5
0
    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)
예제 #6
0
    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)
예제 #7
0
    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)
예제 #8
0
    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)
예제 #9
0
 def verify_encrypted_private_key_equal(self, retrieved_private_key):
     pem = keys.get_encrypted_private_key_pem()
     self.assertEqual(pem, retrieved_private_key)