Removed application/pkix media type

Change-Id: I0c2fdd87afb5e01d1d148a9274d68abec25f39da
Closes-Bug: #1459819
This commit is contained in:
Kiran_totad 2017-02-16 16:36:50 +05:30 committed by Kiran Totad
parent 20f8aebe7b
commit cfb9249643
7 changed files with 13 additions and 15 deletions

View File

@ -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}

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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']
})

View File

@ -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

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
Removed application/pkix media type because Barbican will not be using
media types for format conversion.