Пример #1
0
 def test_passes_certificate_conversion(self):
     pem = keys.get_certificate_pem()
     der = translations.convert_pem_to_der(
         pem, s.SecretType.CERTIFICATE)
     converted_pem = translations.convert_der_to_pem(
         der, s.SecretType.CERTIFICATE)
     self.assertEqual(pem, converted_pem)
Пример #2
0
 def _denormalize_secret(self, secret, secret_type):
     """Converts secret back to the format expected by Barbican core"""
     data = secret
     if secret_type in [ss.SecretType.PUBLIC,
                        ss.SecretType.PRIVATE,
                        ss.SecretType.CERTIFICATE]:
         data = translations.convert_der_to_pem(data, secret_type)
     return base64.b64encode(data)
Пример #3
0
 def _denormalize_secret(self, secret, secret_type):
     """Converts secret back to the format expected by Barbican core"""
     data = secret
     if secret_type in [ss.SecretType.PUBLIC,
                        ss.SecretType.PRIVATE,
                        ss.SecretType.CERTIFICATE]:
         data = translations.convert_der_to_pem(data, secret_type)
     return base64.b64encode(data)
Пример #4
0
 def test_passes_convert_public_der_to_pem(self):
     der = keys.get_public_key_der()
     expected_pem = keys.get_public_key_pem()
     pem = translations.convert_der_to_pem(
         der, s.SecretType.PUBLIC)
     self.assertEqual(expected_pem, pem)
Пример #5
0
 def test_passes_convert_certificate_der_to_pem(self):
     der = keys.get_certificate_der()
     expected_pem = keys.get_certificate_pem()
     pem = translations.convert_der_to_pem(
         der, s.SecretType.CERTIFICATE)
     self.assertEqual(expected_pem, pem)
Пример #6
0
 def test_passes_convert_private_der_to_pem(self):
     der = keys.get_private_key_der()
     expected_pem = keys.get_private_key_pem()
     pem = translations.convert_der_to_pem(
         der, s.SecretType.PRIVATE)
     self.assertEqual(expected_pem, pem)
Пример #7
0
 def test_passes_certificate_conversion(self):
     pem = keys.get_certificate_pem()
     der = translations.convert_pem_to_der(pem, s.SecretType.CERTIFICATE)
     converted_pem = translations.convert_der_to_pem(
         der, s.SecretType.CERTIFICATE)
     self.assertEqual(pem, converted_pem)
Пример #8
0
 def test_passes_convert_certificate_der_to_pem(self):
     der = keys.get_certificate_der()
     expected_pem = keys.get_certificate_pem()
     pem = translations.convert_der_to_pem(der, s.SecretType.CERTIFICATE)
     self.assertEqual(expected_pem, pem)
Пример #9
0
 def test_passes_convert_public_der_to_pem(self):
     der = keys.get_public_key_der()
     expected_pem = keys.get_public_key_pem()
     pem = translations.convert_der_to_pem(der, s.SecretType.PUBLIC)
     self.assertEqual(expected_pem, pem)
Пример #10
0
 def test_passes_convert_private_der_to_pem(self):
     der = keys.get_private_key_der()
     expected_pem = keys.get_private_key_pem()
     pem = translations.convert_der_to_pem(der, s.SecretType.PRIVATE)
     self.assertEqual(expected_pem, pem)