diff options
author | Russ Housley <housley@vigilsec.com> | 2019-08-18 02:12:09 -0400 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-08-18 08:12:09 +0200 |
commit | fdd5c3033d124ad159b9784e3e7fe304f777dbb8 (patch) | |
tree | 112c9e6888f161fc9edff9e759378460c10add33 | |
parent | 999c682a3e9c2d7770b7032fcf67fde0bac153c3 (diff) | |
download | pyasn1-modules-fdd5c3033d124ad159b9784e3e7fe304f777dbb8.tar.gz |
Improve opentypes maps for RFC3709, RFC6402, RFC7191, and RFC8226 (#57)
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | pyasn1_modules/rfc3709.py | 8 | ||||
-rw-r--r-- | pyasn1_modules/rfc6402.py | 11 | ||||
-rw-r--r-- | pyasn1_modules/rfc7191.py | 16 | ||||
-rw-r--r-- | pyasn1_modules/rfc8226.py | 8 | ||||
-rw-r--r-- | tests/test_rfc3709.py | 1 | ||||
-rw-r--r-- | tests/test_rfc5652.py | 2 | ||||
-rwxr-xr-x | tests/test_rfc6402.py | 4 | ||||
-rw-r--r-- | tests/test_rfc7191.py | 5 |
9 files changed, 29 insertions, 28 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 60cb3e4..9f99e8a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,8 @@ Revision 0.2.7, released XX-08-2019 Exchange Syntax v1.1 - Added RFC8018 providing PKCS #5, which is the Password-Based Cryptography Specification, Version 2.1 +- Automatically update the maps for use with openType for RFC3709, + RFC6402, RFC7191, and RFC8226 when the module is imported Revision 0.2.6, released 31-07-2019 ----------------------------------- diff --git a/pyasn1_modules/rfc3709.py b/pyasn1_modules/rfc3709.py index a52f99e..f26ba33 100644 --- a/pyasn1_modules/rfc3709.py +++ b/pyasn1_modules/rfc3709.py @@ -194,9 +194,11 @@ LogotypeExtn.componentType = namedtype.NamedTypes( ) -# Map of Certificate Extension OIDs to Extensions -# To be added to the ones that are in rfc5280.py +# Map of Certificate Extension OIDs to Extensions added to the +# ones that are in rfc5280.py -certificateExtensionsMapUpdate = { +_certificateExtensionsMapUpdate = { id_pe_logotype: LogotypeExtn(), } + +rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate)
\ No newline at end of file diff --git a/pyasn1_modules/rfc6402.py b/pyasn1_modules/rfc6402.py index dbb699a..322e35e 100644 --- a/pyasn1_modules/rfc6402.py +++ b/pyasn1_modules/rfc6402.py @@ -615,10 +615,13 @@ _cmcControlAttributesMapUpdate = { cmcControlAttributesMap.update(_cmcControlAttributesMapUpdate) -# Map of CMC Content Type OIDs to CMC Content Types -# To be added to the ones that are in rfc5652.py +# Map of CMC Content Type OIDs to CMC Content Types are added to +# the ones that are in rfc5652.py -cmsContentTypesMapUpdate = { +_cmsContentTypesMapUpdate = { id_cct_PKIData: PKIData(), id_cct_PKIResponse: PKIResponse(), -}
\ No newline at end of file +} + +rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate) + diff --git a/pyasn1_modules/rfc7191.py b/pyasn1_modules/rfc7191.py index 4f90be1..7c2be11 100644 --- a/pyasn1_modules/rfc7191.py +++ b/pyasn1_modules/rfc7191.py @@ -240,18 +240,22 @@ KeyPkgIdentifierAndReceiptReq.componentType = namedtype.NamedTypes( ) -# Map of Attribute Type OIDs to Attributes -# To be added to the ones that are in rfc5652.py +# Map of Attribute Type OIDs to Attributes are added to +# the ones that are in rfc5652.py -cmsAttributesMapUpdate = { +_cmsAttributesMapUpdate = { id_aa_KP_keyPkgIdAndReceiptReq: KeyPkgIdentifierAndReceiptReq(), } +rfc5652.cmsAttributesMap.update(_cmsAttributesMapUpdate) -# Map of Content Type OIDs to Content Types -# To be added to the ones that are in rfc5652.py -cmsContentTypesMapUpdate = { +# Map of CMC Content Type OIDs to CMC Content Types are added to +# the ones that are in rfc5652.py + +_cmsContentTypesMapUpdate = { id_ct_KP_keyPackageError: KeyPackageError(), id_ct_KP_keyPackageReceipt: KeyPackageReceipt(), } + +rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate) diff --git a/pyasn1_modules/rfc8226.py b/pyasn1_modules/rfc8226.py index 0c3dc21..a5eb211 100644 --- a/pyasn1_modules/rfc8226.py +++ b/pyasn1_modules/rfc8226.py @@ -18,6 +18,7 @@ from pyasn1.type import namedtype from pyasn1.type import tag from pyasn1.type import univ +from pyasn1_modules import rfc5280 MAX = float('inf') @@ -133,11 +134,12 @@ id_pe_TNAuthList = _OID(1, 3, 6, 1, 5, 5, 7, 1, 26) id_ad_stirTNList = _OID(1, 3, 6, 1, 5, 5, 7, 48, 14) -# Map of Certificate Extension OIDs to Extensions -# To be added to the ones that are in rfc5280.py +# Map of Certificate Extension OIDs to Extensions added to the +# ones that are in rfc5280.py -certificateExtensionsMapUpdate = { +_certificateExtensionsMapUpdate = { id_pe_TNAuthList: TNAuthorizationList(), id_pe_JWTClaimConstraints: JWTClaimConstraints(), } +rfc5280.certificateExtensionsMap.update(_certificateExtensionsMapUpdate) diff --git a/tests/test_rfc3709.py b/tests/test_rfc3709.py index a7d0ef8..56753cc 100644 --- a/tests/test_rfc3709.py +++ b/tests/test_rfc3709.py @@ -66,7 +66,6 @@ Pj22pmfmQi5w21UljqoTj/+lQLkU3wfy5BdVKBwI0GfEA+YL3ctSzPNqAA== def testExtensionsMap(self): substrate = pem.readBase64fromText(self.pem_text) - rfc5280.certificateExtensionsMap.update(rfc3709.certificateExtensionsMapUpdate) asn1Object, rest = der_decoder.decode(substrate, asn1Spec=self.asn1Spec) assert not rest assert asn1Object.prettyPrint() diff --git a/tests/test_rfc5652.py b/tests/test_rfc5652.py index eac4262..b34627b 100644 --- a/tests/test_rfc5652.py +++ b/tests/test_rfc5652.py @@ -125,8 +125,6 @@ xicQmJP+VoMHo/ZpjFY9fYCjNZUArgKsEwK/s+p9yrVVeB1Nf8Mn rfc5280.algorithmIdentifierMap.update(algorithmIdentifierMapUpdate) - rfc5652.cmsContentTypesMap.update(rfc6402.cmsContentTypesMapUpdate) - substrate = pem.readBase64fromText(self.pem_text) asn1Object, rest = der_decoder.decode(substrate, diff --git a/tests/test_rfc6402.py b/tests/test_rfc6402.py index 65d5ea9..191078c 100755 --- a/tests/test_rfc6402.py +++ b/tests/test_rfc6402.py @@ -50,8 +50,6 @@ xicQmJP+VoMHo/ZpjFY9fYCjNZUArgKsEwK/s+p9yrVVeB1Nf8Mn """ def testDerCodec(self): - - rfc5652.cmsContentTypesMap.update(rfc6402.cmsContentTypesMapUpdate) layers = rfc5652.cmsContentTypesMap getNextLayer = { @@ -116,8 +114,6 @@ xicQmJP+VoMHo/ZpjFY9fYCjNZUArgKsEwK/s+p9yrVVeB1Nf8Mn rfc5280.algorithmIdentifierMap.update(algorithmIdentifierMapUpdate) - rfc5652.cmsContentTypesMap.update(rfc6402.cmsContentTypesMapUpdate) - substrate = pem.readBase64fromText(self.pem_text) asn1Object, rest = der_decode(substrate, asn1Spec=rfc5652.ContentInfo(), diff --git a/tests/test_rfc7191.py b/tests/test_rfc7191.py index 337bd44..9352c1f 100644 --- a/tests/test_rfc7191.py +++ b/tests/test_rfc7191.py @@ -89,7 +89,6 @@ goRV+bq4fdgOOj25JFqa80xnXGtQqjm/7NSII5SbdJk+DT7KCkSbkElkbgQ= def testOpenTypes(self): substrate = pem.readBase64fromText(self.message1_pem_text) - rfc5652.cmsAttributesMap.update(rfc7191.cmsAttributesMapUpdate) asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True) @@ -165,8 +164,6 @@ bUcOYuCdivgxVuhlAgIxAPR9JavxziwCbVyBUWOAiKKYfglTgG3AwNmrKDj0NtXUQ9qDmGAc def testOpenTypes(self): substrate = pem.readBase64fromText(self.message2_pem_text) - rfc5652.cmsContentTypesMap.update(rfc7191.cmsContentTypesMapUpdate) - rfc5652.cmsAttributesMap.update(rfc7191.cmsAttributesMapUpdate) asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True) @@ -254,8 +251,6 @@ iNF8uKtW/lk0AjA7z2q40N0lamXkSU7ECasiWOYV1X4cWGiQwMZDKknBPDqXqB6Es6p4J+qe def testOpenTypes(self): substrate = pem.readBase64fromText(self.message3_pem_text) - rfc5652.cmsContentTypesMap.update(rfc7191.cmsContentTypesMapUpdate) - rfc5652.cmsAttributesMap.update(rfc7191.cmsAttributesMapUpdate) asn1Object, rest = der_decode (substrate, asn1Spec=self.asn1Spec, decodeOpenTypes=True) |