From cfb924964360d0623cd7fadc25414f582c036eff Mon Sep 17 00:00:00 2001 From: Kiran_totad Date: Thu, 16 Feb 2017 16:36:50 +0530 Subject: [PATCH] Removed application/pkix media type Change-Id: I0c2fdd87afb5e01d1d148a9274d68abec25f39da Closes-Bug: #1459819 --- barbican/plugin/util/mime_types.py | 7 +------ barbican/tasks/certificate_resources.py | 4 ++-- barbican/tests/common/test_validators.py | 2 +- barbican/tests/plugin/test_store_crypto.py | 2 +- barbican/tests/plugin/util/test_mime_types.py | 4 +--- .../api/v1/functional/test_certificate_orders.py | 4 ++-- releasenotes/notes/remove_pkix-b045e7dde7e47356.yaml | 5 +++++ 7 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 releasenotes/notes/remove_pkix-b045e7dde7e47356.yaml diff --git a/barbican/plugin/util/mime_types.py b/barbican/plugin/util/mime_types.py index c650fbcf3..ab7c8f060 100644 --- a/barbican/plugin/util/mime_types.py +++ b/barbican/plugin/util/mime_types.py @@ -29,8 +29,7 @@ PLAIN_TEXT = ['text/plain', 'text/plain; charset=utf-8'] PLAIN_TEXT_CHARSETS = ['utf-8'] BINARY = ['application/octet-stream', - 'application/pkcs8', - 'application/pkix-cert'] + 'application/pkcs8'] SUPPORTED = PLAIN_TEXT + BINARY # Normalizes client types to internal types. @@ -39,7 +38,6 @@ INTERNAL_CTYPES = {'text/plain': 'text/plain', 'text/plain; charset=utf-8': 'text/plain', 'application/octet-stream': 'application/octet-stream', 'application/pkcs8': 'application/pkcs8', - 'application/pkix-cert': 'application/pkix-cert', 'application/aes': 'application/aes'} # Maps mime-types used to specify secret data formats to the types that can @@ -49,12 +47,10 @@ INTERNAL_CTYPES = {'text/plain': 'text/plain', CTYPES_PLAIN = {'default': 'text/plain'} CTYPES_BINARY = {'default': 'application/octet-stream'} CTYPES_PKCS8 = {'default': 'application/pkcs8'} -CTYPES_PKIX_CERT = {'default': 'application/pkix-cert'} CTYPES_AES = {'default': 'application/aes'} CTYPES_MAPPINGS = {'text/plain': CTYPES_PLAIN, 'application/octet-stream': CTYPES_BINARY, 'application/pkcs8': CTYPES_PKCS8, - 'application/pkix-cert': CTYPES_PKIX_CERT, 'application/aes': CTYPES_AES} # Supported encodings @@ -64,7 +60,6 @@ ENCODINGS = ['base64'] CTYPES_TO_ENCODINGS = {'text/plain': None, 'application/octet-stream': ['base64', 'binary'], 'application/pkcs8': ['base64', 'binary'], - 'application/pkix-cert': ['base64', 'binary'], 'application/aes': None} diff --git a/barbican/tasks/certificate_resources.py b/barbican/tasks/certificate_resources.py index 7fd57e35b..8143afb0d 100644 --- a/barbican/tasks/certificate_resources.py +++ b/barbican/tasks/certificate_resources.py @@ -546,7 +546,7 @@ def _save_barbican_metadata(order_model, barbican_meta): def _save_secrets(result, project_model, request_type, order_model): cert_secret_model, transport_key_model = plugin.store_secret( unencrypted_raw=result.certificate, - content_type_raw='application/pkix-cert', + content_type_raw='application/octet-stream', content_encoding='base64', secret_model=models.Secret(), project_model=project_model) @@ -555,7 +555,7 @@ def _save_secrets(result, project_model, request_type, order_model): if result.intermediates: intermediates_secret_model, transport_key_model = plugin.store_secret( unencrypted_raw=result.intermediates, - content_type_raw='application/pkix-cert', + content_type_raw='application/octet-stream', content_encoding='base64', secret_model=models.Secret(), project_model=project_model diff --git a/barbican/tests/common/test_validators.py b/barbican/tests/common/test_validators.py index 26edf1792..d89395204 100644 --- a/barbican/tests/common/test_validators.py +++ b/barbican/tests/common/test_validators.py @@ -62,7 +62,7 @@ def get_public_key_req(): def get_certificate_req(): return {'name': 'mycertificate', - 'payload_content_type': 'application/pkix-cert', + 'payload_content_type': 'application/octet-stream', 'payload_content_encoding': 'base64', 'algorithm': 'rsa', 'bit_length': 2048, diff --git a/barbican/tests/plugin/test_store_crypto.py b/barbican/tests/plugin/test_store_crypto.py index 35e55bf03..a6338a667 100644 --- a/barbican/tests/plugin/test_store_crypto.py +++ b/barbican/tests/plugin/test_store_crypto.py @@ -50,7 +50,7 @@ def get_certificate_dto(): base64.b64encode( keys.get_certificate_pem()), spec, - 'application/pkix-cert') + 'application/octet-stream') class TestSecretStoreBase(testtools.TestCase, diff --git a/barbican/tests/plugin/util/test_mime_types.py b/barbican/tests/plugin/util/test_mime_types.py index 95e991e5d..87a9e6c12 100644 --- a/barbican/tests/plugin/util/test_mime_types.py +++ b/barbican/tests/plugin/util/test_mime_types.py @@ -203,8 +203,7 @@ class WhenTestingIfContentTypeAndEncodingSupported(utils.BaseTestCase): @utils.parameterized_dataset({ 'plaintext_none': ['text/plain', None], 'octectstream_base64': ['application/octet-stream', 'base64'], - 'pkcs8_base64': ['application/pkcs8', 'base64'], - 'pkix_base64': ['application/pkix-cert', 'base64'], + 'pkcs8_base64': ['application/pkcs8', 'base64'] }) def test_content_type_encoding_supported(self, content_type, encoding): self.assertTrue(mime_types.is_content_type_with_encoding_supported( @@ -215,7 +214,6 @@ class WhenTestingIfContentTypeAndEncodingSupported(utils.BaseTestCase): 'plaintext_none': ['text/plain', 'base64'], 'octectstream_no_encoding': ['application/octet-stream', None], 'pkcs8_no_encoding': ['application/pkcs8', None], - 'pkix_no_encoding': ['application/pkix-cert', None], 'unknown_with_valid_encoding': ['application/uknown-content-type', 'base64'] }) diff --git a/functionaltests/api/v1/functional/test_certificate_orders.py b/functionaltests/api/v1/functional/test_certificate_orders.py index 8f842a49c..3d3bb5ec9 100644 --- a/functionaltests/api/v1/functional/test_certificate_orders.py +++ b/functionaltests/api/v1/functional/test_certificate_orders.py @@ -258,7 +258,7 @@ class CertificatesTestCase(base.TestCase): def verify_valid_cert(self, secret_ref): secret_resp = self.secret_behaviors.get_secret( secret_ref, - "application/pkix-cert") + "application/octet-stream") self.assertIsNotNone(secret_resp) self.assertIsNotNone(secret_resp.content) cert = secret_resp.content @@ -267,7 +267,7 @@ class CertificatesTestCase(base.TestCase): def verify_valid_intermediates(self, secret_ref): secret_resp = self.secret_behaviors.get_secret( secret_ref, - "application/pkix-cert") + "application/octet-stream") self.assertIsNotNone(secret_resp) self.assertIsNotNone(secret_resp.content) cert_chain = secret_resp.content diff --git a/releasenotes/notes/remove_pkix-b045e7dde7e47356.yaml b/releasenotes/notes/remove_pkix-b045e7dde7e47356.yaml new file mode 100644 index 000000000..c53de733d --- /dev/null +++ b/releasenotes/notes/remove_pkix-b045e7dde7e47356.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + Removed application/pkix media type because Barbican will not be using + media types for format conversion. \ No newline at end of file