diff options
author | Russ Housley <housley@vigilsec.com> | 2019-07-20 06:58:55 -0400 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-07-20 12:58:55 +0200 |
commit | 23608be1bc0ce8a4ac5fbaba92af905c88ea4ab6 (patch) | |
tree | 67be142d26a66e2a874502f60c3e97d0059bd769 /pyasn1_modules | |
parent | 06f5be85d5229cffeb24f9ae622df665d7ae506b (diff) | |
download | pyasn1-modules-23608be1bc0ce8a4ac5fbaba92af905c88ea4ab6.tar.gz |
Added maps for use with openType (#53)
Diffstat (limited to 'pyasn1_modules')
-rw-r--r-- | pyasn1_modules/rfc2634.py | 9 | ||||
-rw-r--r-- | pyasn1_modules/rfc3274.py | 11 | ||||
-rw-r--r-- | pyasn1_modules/rfc3709.py | 70 | ||||
-rw-r--r-- | pyasn1_modules/rfc3779.py | 39 | ||||
-rw-r--r-- | pyasn1_modules/rfc4073.py | 10 | ||||
-rw-r--r-- | pyasn1_modules/rfc4108.py | 111 | ||||
-rw-r--r-- | pyasn1_modules/rfc5035.py | 9 | ||||
-rw-r--r-- | pyasn1_modules/rfc5083.py | 26 | ||||
-rw-r--r-- | pyasn1_modules/rfc5940.py | 10 | ||||
-rw-r--r-- | pyasn1_modules/rfc5958.py | 24 | ||||
-rw-r--r-- | pyasn1_modules/rfc6019.py | 12 | ||||
-rw-r--r-- | pyasn1_modules/rfc6402.py | 61 | ||||
-rw-r--r-- | pyasn1_modules/rfc7191.py | 27 | ||||
-rw-r--r-- | pyasn1_modules/rfc8226.py | 66 | ||||
-rw-r--r-- | pyasn1_modules/rfc8520.py | 18 |
15 files changed, 363 insertions, 140 deletions
diff --git a/pyasn1_modules/rfc2634.py b/pyasn1_modules/rfc2634.py index c9e387d..336ae64 100644 --- a/pyasn1_modules/rfc2634.py +++ b/pyasn1_modules/rfc2634.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add a map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -320,3 +321,11 @@ ESSAttributeMap = { id_aa_contentHint: ContentHints(), id_aa_receiptRequest: ReceiptRequest(), } + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_receipt: Receipt(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc3274.py b/pyasn1_modules/rfc3274.py index bf8a7a6..8d8541c 100644 --- a/pyasn1_modules/rfc3274.py +++ b/pyasn1_modules/rfc3274.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add a map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -45,4 +46,12 @@ id_alg_zlibCompress = univ.ObjectIdentifier('1.2.840.113549.1.9.16.3.8') cpa_zlibCompress = rfc5280.AlgorithmIdentifier() cpa_zlibCompress['algorithm'] = id_alg_zlibCompress -# cpa_zlibCompress['parameters'] are absent
\ No newline at end of file +# cpa_zlibCompress['parameters'] are absent + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_compressedData: CompressedData(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc3709.py b/pyasn1_modules/rfc3709.py index 52085fb..ed1e667 100644 --- a/pyasn1_modules/rfc3709.py +++ b/pyasn1_modules/rfc3709.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add maps for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -9,10 +10,16 @@ # Logotypes in X.509 Certificates # # ASN.1 source from: -# https://www.rfc-editor.org/rfc/rfc3779.txt +# https://www.rfc-editor.org/rfc/rfc3709.txt # -from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful +from pyasn1.type import char +from pyasn1.type import constraint +from pyasn1.type import namedtype +from pyasn1.type import namedval +from pyasn1.type import tag +from pyasn1.type import univ + from pyasn1_modules import rfc5280 MAX = float('inf') @@ -21,7 +28,6 @@ MAX = float('inf') class HashAlgAndValue(univ.Sequence): pass - HashAlgAndValue.componentType = namedtype.NamedTypes( namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()), namedtype.NamedType('hashValue', univ.OctetString()) @@ -31,20 +37,20 @@ HashAlgAndValue.componentType = namedtype.NamedTypes( class LogotypeDetails(univ.Sequence): pass - LogotypeDetails.componentType = namedtype.NamedTypes( namedtype.NamedType('mediaType', char.IA5String()), namedtype.NamedType('logotypeHash', univ.SequenceOf( - componentType=HashAlgAndValue()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), + componentType=HashAlgAndValue()).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), namedtype.NamedType('logotypeURI', univ.SequenceOf( - componentType=char.IA5String()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) + componentType=char.IA5String()).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) ) class LogotypeAudioInfo(univ.Sequence): pass - LogotypeAudioInfo.componentType = namedtype.NamedTypes( namedtype.NamedType('fileSize', univ.Integer()), namedtype.NamedType('playTime', univ.Integer()), @@ -59,7 +65,6 @@ LogotypeAudioInfo.componentType = namedtype.NamedTypes( class LogotypeAudio(univ.Sequence): pass - LogotypeAudio.componentType = namedtype.NamedTypes( namedtype.NamedType('audioDetails', LogotypeDetails()), namedtype.OptionalNamedType('audioInfo', LogotypeAudioInfo()) @@ -69,7 +74,6 @@ LogotypeAudio.componentType = namedtype.NamedTypes( class LogotypeImageType(univ.Integer): pass - LogotypeImageType.namedValues = namedval.NamedValues( ('grayScale', 0), ('color', 1) @@ -79,22 +83,23 @@ LogotypeImageType.namedValues = namedval.NamedValues( class LogotypeImageResolution(univ.Choice): pass - LogotypeImageResolution.componentType = namedtype.NamedTypes( namedtype.NamedType('numBits', - univ.Integer().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))), + univ.Integer().subtype(implicitTag=tag.Tag( + tag.tagClassContext, tag.tagFormatSimple, 1))), namedtype.NamedType('tableSize', - univ.Integer().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))) + univ.Integer().subtype(implicitTag=tag.Tag( + tag.tagClassContext, tag.tagFormatSimple, 2))) ) class LogotypeImageInfo(univ.Sequence): pass - LogotypeImageInfo.componentType = namedtype.NamedTypes( namedtype.DefaultedNamedType('type', LogotypeImageType().subtype( - implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value='color')), + implicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatSimple, 0)).subtype(value='color')), namedtype.NamedType('fileSize', univ.Integer()), namedtype.NamedType('xSize', univ.Integer()), namedtype.NamedType('ySize', univ.Integer()), @@ -107,7 +112,6 @@ LogotypeImageInfo.componentType = namedtype.NamedTypes( class LogotypeImage(univ.Sequence): pass - LogotypeImage.componentType = namedtype.NamedTypes( namedtype.NamedType('imageDetails', LogotypeDetails()), namedtype.OptionalNamedType('imageInfo', LogotypeImageInfo()) @@ -117,36 +121,39 @@ LogotypeImage.componentType = namedtype.NamedTypes( class LogotypeData(univ.Sequence): pass - LogotypeData.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('image', univ.SequenceOf( componentType=LogotypeImage())), namedtype.OptionalNamedType('audio', univ.SequenceOf( - componentType=LogotypeAudio()).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) + componentType=LogotypeAudio()).subtype( + implicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatSimple, 1))) ) class LogotypeReference(univ.Sequence): pass - LogotypeReference.componentType = namedtype.NamedTypes( namedtype.NamedType('refStructHash', univ.SequenceOf( - componentType=HashAlgAndValue()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), + componentType=HashAlgAndValue()).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX))), namedtype.NamedType('refStructURI', univ.SequenceOf( - componentType=char.IA5String()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) + componentType=char.IA5String()).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) ) class LogotypeInfo(univ.Choice): pass - LogotypeInfo.componentType = namedtype.NamedTypes( namedtype.NamedType('direct', - LogotypeData().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), + LogotypeData().subtype(implicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatConstructed, 0))), namedtype.NamedType('indirect', LogotypeReference().subtype( - implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))) + implicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatConstructed, 1))) ) # Other logotype type and associated object identifiers @@ -159,12 +166,12 @@ id_logo_loyalty = univ.ObjectIdentifier('1.3.6.1.5.5.7.20.1') class OtherLogotypeInfo(univ.Sequence): pass - OtherLogotypeInfo.componentType = namedtype.NamedTypes( namedtype.NamedType('logotypeType', univ.ObjectIdentifier()), namedtype.NamedType('info', LogotypeInfo()) ) + # Logotype Certificate Extension id_pe_logotype = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.12') @@ -173,14 +180,23 @@ id_pe_logotype = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.12') class LogotypeExtn(univ.Sequence): pass - LogotypeExtn.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('communityLogos', univ.SequenceOf( - componentType=LogotypeInfo()).subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), + componentType=LogotypeInfo()).subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), namedtype.OptionalNamedType('issuerLogo', LogotypeInfo().subtype( explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))), namedtype.OptionalNamedType('subjectLogo', LogotypeInfo().subtype( explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2))), namedtype.OptionalNamedType('otherLogos', univ.SequenceOf( - componentType=OtherLogotypeInfo()).subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 3))) + componentType=OtherLogotypeInfo()).subtype(explicitTag=tag.Tag( + tag.tagClassContext, tag.tagFormatSimple, 3))) ) + + +# Map of Certificate Extension OIDs to Extensions +# To be added to the ones that are in rfc5280.py + +certificateExtensionsMapUpdate = { + id_pe_logotype: LogotypeExtn(), +} diff --git a/pyasn1_modules/rfc3779.py b/pyasn1_modules/rfc3779.py index b4dd994..125351e 100644 --- a/pyasn1_modules/rfc3779.py +++ b/pyasn1_modules/rfc3779.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add maps for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -12,12 +13,12 @@ # https://www.rfc-editor.org/rfc/rfc3779.txt # - from pyasn1.type import constraint from pyasn1.type import namedtype from pyasn1.type import tag from pyasn1.type import univ + # IP Address Delegation Extension id_pe_ipAddrBlocks = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.7') @@ -30,7 +31,6 @@ class IPAddress(univ.BitString): class IPAddressRange(univ.Sequence): pass - IPAddressRange.componentType = namedtype.NamedTypes( namedtype.NamedType('min', IPAddress()), namedtype.NamedType('max', IPAddress()) @@ -40,7 +40,6 @@ IPAddressRange.componentType = namedtype.NamedTypes( class IPAddressOrRange(univ.Choice): pass - IPAddressOrRange.componentType = namedtype.NamedTypes( namedtype.NamedType('addressPrefix', IPAddress()), namedtype.NamedType('addressRange', IPAddressRange()) @@ -50,19 +49,20 @@ IPAddressOrRange.componentType = namedtype.NamedTypes( class IPAddressChoice(univ.Choice): pass - IPAddressChoice.componentType = namedtype.NamedTypes( namedtype.NamedType('inherit', univ.Null()), - namedtype.NamedType('addressesOrRanges', univ.SequenceOf(componentType=IPAddressOrRange())) + namedtype.NamedType('addressesOrRanges', univ.SequenceOf( + componentType=IPAddressOrRange()) + ) ) class IPAddressFamily(univ.Sequence): pass - IPAddressFamily.componentType = namedtype.NamedTypes( - namedtype.NamedType('addressFamily', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(2, 3))), + namedtype.NamedType('addressFamily', univ.OctetString().subtype( + subtypeSpec=constraint.ValueSizeConstraint(2, 3))), namedtype.NamedType('ipAddressChoice', IPAddressChoice()) ) @@ -70,9 +70,9 @@ IPAddressFamily.componentType = namedtype.NamedTypes( class IPAddrBlocks(univ.SequenceOf): pass - IPAddrBlocks.componentType = IPAddressFamily() + # Autonomous System Identifier Delegation Extension id_pe_autonomousSysIds = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.8') @@ -85,7 +85,6 @@ class ASId(univ.Integer): class ASRange(univ.Sequence): pass - ASRange.componentType = namedtype.NamedTypes( namedtype.NamedType('min', ASId()), namedtype.NamedType('max', ASId()) @@ -95,7 +94,6 @@ ASRange.componentType = namedtype.NamedTypes( class ASIdOrRange(univ.Choice): pass - ASIdOrRange.componentType = namedtype.NamedTypes( namedtype.NamedType('id', ASId()), namedtype.NamedType('range', ASRange()) @@ -105,20 +103,31 @@ ASIdOrRange.componentType = namedtype.NamedTypes( class ASIdentifierChoice(univ.Choice): pass - ASIdentifierChoice.componentType = namedtype.NamedTypes( namedtype.NamedType('inherit', univ.Null()), - namedtype.NamedType('asIdsOrRanges', univ.SequenceOf(componentType=ASIdOrRange())) + namedtype.NamedType('asIdsOrRanges', univ.SequenceOf( + componentType=ASIdOrRange()) + ) ) class ASIdentifiers(univ.Sequence): pass - ASIdentifiers.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('asnum', ASIdentifierChoice().subtype( - explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0))), + explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatConstructed, 0))), namedtype.OptionalNamedType('rdi', ASIdentifierChoice().subtype( - explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))) + explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatConstructed, 1))) ) + + +# Map of Certificate Extension OIDs to Extensions +# To be added to the ones that are in rfc5280.py + +certificateExtensionsMapUpdate = { + id_pe_ipAddrBlocks: IPAddrBlocks(), + id_pe_autonomousSysIds: ASIdentifiers(), +} diff --git a/pyasn1_modules/rfc4073.py b/pyasn1_modules/rfc4073.py index 97b6381..9713031 100644 --- a/pyasn1_modules/rfc4073.py +++ b/pyasn1_modules/rfc4073.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with some assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add a map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -45,3 +46,12 @@ ContentWithAttributes.componentType = namedtype.NamedTypes( componentType=rfc5652.Attribute()).subtype( subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) ) + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_contentCollection: ContentCollection(), + id_ct_contentWithAttrs: ContentWithAttributes(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc4108.py b/pyasn1_modules/rfc4108.py index 243f1fb..c5cdfe9 100644 --- a/pyasn1_modules/rfc4108.py +++ b/pyasn1_modules/rfc4108.py @@ -2,6 +2,8 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add items from the verified errata. +# Modified by Russ Housley to add maps for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -10,15 +12,13 @@ # # ASN.1 source from: # https://www.rfc-editor.org/rfc/rfc4108.txt +# https://www.rfc-editor.org/errata_search.php?rfc=4108 # -from pyasn1.type import constraint -from pyasn1.type import namedtype -from pyasn1.type import namedval -from pyasn1.type import tag -from pyasn1.type import univ +from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful +from pyasn1_modules import rfc5280 from pyasn1_modules import rfc5652 MAX = float('inf') @@ -27,7 +27,6 @@ MAX = float('inf') class HardwareSerialEntry(univ.Choice): pass - HardwareSerialEntry.componentType = namedtype.NamedTypes( namedtype.NamedType('all', univ.Null()), namedtype.NamedType('single', univ.OctetString()), @@ -35,14 +34,13 @@ HardwareSerialEntry.componentType = namedtype.NamedTypes( namedtype.NamedType('low', univ.OctetString()), namedtype.NamedType('high', univ.OctetString()) )) - ) + ) ) class HardwareModules(univ.Sequence): pass - HardwareModules.componentType = namedtype.NamedTypes( namedtype.NamedType('hwType', univ.ObjectIdentifier()), namedtype.NamedType('hwSerialEntries', univ.SequenceOf(componentType=HardwareSerialEntry())) @@ -52,17 +50,16 @@ HardwareModules.componentType = namedtype.NamedTypes( class CommunityIdentifier(univ.Choice): pass - CommunityIdentifier.componentType = namedtype.NamedTypes( namedtype.NamedType('communityOID', univ.ObjectIdentifier()), namedtype.NamedType('hwModuleList', HardwareModules()) ) + class PreferredPackageIdentifier(univ.Sequence): pass - PreferredPackageIdentifier.componentType = namedtype.NamedTypes( namedtype.NamedType('fwPkgID', univ.ObjectIdentifier()), namedtype.NamedType('verNum', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX))) @@ -72,7 +69,6 @@ PreferredPackageIdentifier.componentType = namedtype.NamedTypes( class PreferredOrLegacyPackageIdentifier(univ.Choice): pass - PreferredOrLegacyPackageIdentifier.componentType = namedtype.NamedTypes( namedtype.NamedType('preferred', PreferredPackageIdentifier()), namedtype.NamedType('legacy', univ.OctetString()) @@ -82,7 +78,6 @@ PreferredOrLegacyPackageIdentifier.componentType = namedtype.NamedTypes( class CurrentFWConfig(univ.Sequence): pass - CurrentFWConfig.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('fwPkgType', univ.Integer()), namedtype.NamedType('fwPkgName', PreferredOrLegacyPackageIdentifier()) @@ -92,10 +87,8 @@ CurrentFWConfig.componentType = namedtype.NamedTypes( class PreferredOrLegacyStalePackageIdentifier(univ.Choice): pass - PreferredOrLegacyStalePackageIdentifier.componentType = namedtype.NamedTypes( - namedtype.NamedType('preferredStaleVerNum', - univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX))), + namedtype.NamedType('preferredStaleVerNum', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(0, MAX))), namedtype.NamedType('legacyStaleVersion', univ.OctetString()) ) @@ -103,7 +96,6 @@ PreferredOrLegacyStalePackageIdentifier.componentType = namedtype.NamedTypes( class FirmwarePackageLoadErrorCode(univ.Enumerated): pass - FirmwarePackageLoadErrorCode.namedValues = namedval.NamedValues( ('decodeFailure', 1), ('badContentInfo', 2), @@ -149,11 +141,10 @@ class VendorLoadErrorCode(univ.Integer): pass -# Wrapped Firmware Key Unsigned Attribute and Object Identifiers +# Wrapped Firmware Key Unsigned Attribute and Object Identifier id_aa_wrappedFirmwareKey = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.39') - class WrappedFirmwareKey(rfc5652.EnvelopedData): pass @@ -162,11 +153,9 @@ class WrappedFirmwareKey(rfc5652.EnvelopedData): id_aa_firmwarePackageInfo = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.42') - class FirmwarePackageInfo(univ.Sequence): pass - FirmwarePackageInfo.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('fwPkgType', univ.Integer()), namedtype.OptionalNamedType('dependencies', univ.SequenceOf(componentType=PreferredOrLegacyPackageIdentifier())) @@ -174,44 +163,41 @@ FirmwarePackageInfo.componentType = namedtype.NamedTypes( FirmwarePackageInfo.sizeSpec = univ.Sequence.sizeSpec + constraint.ValueSizeConstraint(1, 2) + # Community Identifiers Signed Attribute and Object Identifier id_aa_communityIdentifiers = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.40') - class CommunityIdentifiers(univ.SequenceOf): pass - CommunityIdentifiers.componentType = CommunityIdentifier() + # Implemented Compression Algorithms Signed Attribute and Object Identifier id_aa_implCompressAlgs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.43') - class ImplementedCompressAlgorithms(univ.SequenceOf): pass - ImplementedCompressAlgorithms.componentType = univ.ObjectIdentifier() + # Implemented Cryptographic Algorithms Signed Attribute and Object Identifier id_aa_implCryptoAlgs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.38') - class ImplementedCryptoAlgorithms(univ.SequenceOf): pass - ImplementedCryptoAlgorithms.componentType = univ.ObjectIdentifier() + # Decrypt Key Identifier Signed Attribute and Object Identifier id_aa_decryptKeyID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.37') - class DecryptKeyIdentifier(univ.OctetString): pass @@ -220,45 +206,53 @@ class DecryptKeyIdentifier(univ.OctetString): id_aa_targetHardwareIDs = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.36') - class TargetHardwareIdentifiers(univ.SequenceOf): pass - TargetHardwareIdentifiers.componentType = univ.ObjectIdentifier() + # Firmware Package Identifier Signed Attribute and Object Identifier id_aa_firmwarePackageID = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.35') - class FirmwarePackageIdentifier(univ.Sequence): pass - FirmwarePackageIdentifier.componentType = namedtype.NamedTypes( namedtype.NamedType('name', PreferredOrLegacyPackageIdentifier()), namedtype.OptionalNamedType('stale', PreferredOrLegacyStalePackageIdentifier()) ) +# Firmware Package Message Digest Signed Attribute and Object Identifier + +id_aa_fwPkgMessageDigest = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.41') + +class FirmwarePackageMessageDigest(univ.Sequence): + pass + +FirmwarePackageMessageDigest.componentType = namedtype.NamedTypes( + namedtype.NamedType('algorithm', rfc5280.AlgorithmIdentifier()), + namedtype.NamedType('msgDigest', univ.OctetString()) +) + + # Firmware Package Load Error Report Content Type and Object Identifier class FWErrorVersion(univ.Integer): pass - FWErrorVersion.namedValues = namedval.NamedValues( ('v1', 1) ) -id_ct_firmwareLoadError = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.18') +id_ct_firmwareLoadError = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.18') class FirmwarePackageLoadError(univ.Sequence): pass - FirmwarePackageLoadError.componentType = namedtype.NamedTypes( namedtype.DefaultedNamedType('version', FWErrorVersion().subtype(value='v1')), namedtype.NamedType('hwType', univ.ObjectIdentifier()), @@ -266,8 +260,7 @@ FirmwarePackageLoadError.componentType = namedtype.NamedTypes( namedtype.NamedType('errorCode', FirmwarePackageLoadErrorCode()), namedtype.OptionalNamedType('vendorErrorCode', VendorLoadErrorCode()), namedtype.OptionalNamedType('fwPkgName', PreferredOrLegacyPackageIdentifier()), - namedtype.OptionalNamedType('config', univ.SequenceOf(componentType=CurrentFWConfig()).subtype( - implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) + namedtype.OptionalNamedType('config', univ.SequenceOf(componentType=CurrentFWConfig()).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) ) @@ -276,33 +269,30 @@ FirmwarePackageLoadError.componentType = namedtype.NamedTypes( class FWReceiptVersion(univ.Integer): pass - FWReceiptVersion.namedValues = namedval.NamedValues( ('v1', 1) ) -id_ct_firmwareLoadReceipt = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.17') +id_ct_firmwareLoadReceipt = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.17') class FirmwarePackageLoadReceipt(univ.Sequence): pass - FirmwarePackageLoadReceipt.componentType = namedtype.NamedTypes( namedtype.DefaultedNamedType('version', FWReceiptVersion().subtype(value='v1')), namedtype.NamedType('hwType', univ.ObjectIdentifier()), namedtype.NamedType('hwSerialNum', univ.OctetString()), namedtype.NamedType('fwPkgName', PreferredOrLegacyPackageIdentifier()), namedtype.OptionalNamedType('trustAnchorKeyID', univ.OctetString()), - namedtype.OptionalNamedType('decryptKeyID', univ.OctetString().subtype( - implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) + namedtype.OptionalNamedType('decryptKeyID', univ.OctetString().subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) ) + # Firmware Package Content Type and Object Identifier id_ct_firmwarePackage = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.16') - class FirmwarePkgData(univ.OctetString): pass @@ -311,12 +301,45 @@ class FirmwarePkgData(univ.OctetString): id_on_hardwareModuleName = univ.ObjectIdentifier('1.3.6.1.5.5.7.8.4') - class HardwareModuleName(univ.Sequence): pass - HardwareModuleName.componentType = namedtype.NamedTypes( namedtype.NamedType('hwType', univ.ObjectIdentifier()), namedtype.NamedType('hwSerialNum', univ.OctetString()) ) + + +# Map of Attribute Type OIDs to Attributes +# To be added to the ones that are in rfc5652.py + +cmsAttributesMapUpdate = { + id_aa_wrappedFirmwareKey: WrappedFirmwareKey(), + id_aa_firmwarePackageInfo: FirmwarePackageInfo(), + id_aa_communityIdentifiers: CommunityIdentifiers(), + id_aa_implCompressAlgs: ImplementedCompressAlgorithms(), + id_aa_implCryptoAlgs: ImplementedCryptoAlgorithms(), + id_aa_decryptKeyID: DecryptKeyIdentifier(), + id_aa_targetHardwareIDs: TargetHardwareIdentifiers(), + id_aa_firmwarePackageID: FirmwarePackageIdentifier(), + id_aa_fwPkgMessageDigest: FirmwarePackageMessageDigest(), +} + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_firmwareLoadError: FirmwarePackageLoadError(), + id_ct_firmwareLoadReceipt: FirmwarePackageLoadReceipt(), + id_ct_firmwarePackage: FirmwarePkgData(), +} + + +# Map of Other Name OIDs to Other Name +# To be added to the ones that are in rfc5280.py + +anotherNameMapUpdate = { + id_on_hardwareModuleName: HardwareModuleName(), +} + diff --git a/pyasn1_modules/rfc5035.py b/pyasn1_modules/rfc5035.py index 5cf0d0d..4a70bb0 100644 --- a/pyasn1_modules/rfc5035.py +++ b/pyasn1_modules/rfc5035.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add a map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -187,3 +188,11 @@ _ESSAttributeMapAddition = { } ESSAttributeMap.update(_ESSAttributeMapAddition) + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_receipt: Receipt(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc5083.py b/pyasn1_modules/rfc5083.py index d3a7f62..e3df086 100644 --- a/pyasn1_modules/rfc5083.py +++ b/pyasn1_modules/rfc5083.py @@ -1,7 +1,10 @@ # This file is being contributed to of pyasn1-modules software. # # Created by Russ Housley without assistance from the asn1ate tool. -# Copyright (c) 2018, Vigil Security, LLC +# Modified by Russ Housley to add a map for use with opentypes and +# simplify the code for the object identifier assignment. +# +# Copyright (c) 2018, 2019 Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # # Authenticated-Enveloped-Data for the Cryptographic Message Syntax (CMS) @@ -18,18 +21,9 @@ from pyasn1_modules import rfc5652 MAX = float('inf') -def _buildOid(*components): - output = [] - for x in tuple(components): - if isinstance(x, univ.ObjectIdentifier): - output.extend(list(x)) - else: - output.append(int(x)) - return univ.ObjectIdentifier(output) - - -id_ct_authEnvelopedData = _buildOid(1, 2, 840, 113549, 1, 9, 16, 1, 23) +# CMS Authenticated-Enveloped-Data Content Type +id_ct_authEnvelopedData = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.23') class AuthEnvelopedData(univ.Sequence): pass @@ -46,3 +40,11 @@ AuthEnvelopedData.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('unauthAttrs', rfc5652.UnauthAttributes().subtype( implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))) ) + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_authEnvelopedData: AuthEnvelopedData(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc5940.py b/pyasn1_modules/rfc5940.py index 1998e26..c5ae0c8 100644 --- a/pyasn1_modules/rfc5940.py +++ b/pyasn1_modules/rfc5940.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -44,3 +45,12 @@ SCVPReqRes.componentType = namedtype.NamedTypes( namedtype.OptionalNamedType('request', ContentInfo().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), namedtype.NamedType('response', ContentInfo()) ) + + +# Map of Revocation Info Format OIDs to Revocation Info Format +# To be added to the ones that are in rfc5652.py + +otherRevInfoFormatMapUpdate = { + id_ri_ocsp_response: OCSPResponse(), + id_ri_scvp: SCVPReqRes(), +} diff --git a/pyasn1_modules/rfc5958.py b/pyasn1_modules/rfc5958.py index 20ace16..32d5857 100644 --- a/pyasn1_modules/rfc5958.py +++ b/pyasn1_modules/rfc5958.py @@ -2,6 +2,7 @@ # This file is being contributed to pyasn1-modules software. # # Created by Russ Housley. +# Modified by Russ Housley to add a map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -10,16 +11,13 @@ # the PrivateKeyInfo structure in PKCS#8 in RFC 5208 # # ASN.1 source from: -# https://www.rfc-editor.org/rfc/rfc8418.txt +# https://www.rfc-editor.org/rfc/rfc5958.txt -from pyasn1.type import constraint -from pyasn1.type import namedtype -from pyasn1.type import namedval -from pyasn1.type import tag -from pyasn1.type import univ +from pyasn1.type import univ, constraint, namedtype, namedval, tag from pyasn1_modules import rfc5280 + MAX = float('inf') @@ -55,7 +53,7 @@ class Attributes(univ.SetOf): class PublicKey(univ.BitString): - pass + pass # OneAsymmetricKey is essentially version 2 of PrivateKeyInfo. @@ -82,10 +80,16 @@ class PrivateKeyInfo(OneAsymmetricKey): id_ct_KP_aKeyPackage = univ.ObjectIdentifier('2.16.840.1.101.2.1.2.78.5') - class AsymmetricKeyPackage(univ.SequenceOf): pass - AsymmetricKeyPackage.componentType = OneAsymmetricKey() -AsymmetricKeyPackage.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) +AsymmetricKeyPackage.subtypeSpec=constraint.ValueSizeConstraint(1, MAX) + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_KP_aKeyPackage: AsymmetricKeyPackage(), +} diff --git a/pyasn1_modules/rfc6019.py b/pyasn1_modules/rfc6019.py index 9cdf2ab..7816593 100644 --- a/pyasn1_modules/rfc6019.py +++ b/pyasn1_modules/rfc6019.py @@ -1,6 +1,7 @@ # This file is being contributed to pyasn1-modules software. # # Created by Russ Housley. +# Modified by Russ Housley to add a map for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -21,13 +22,20 @@ MAX = float('inf') class BinaryTime(univ.Integer): pass - BinaryTime.subtypeSpec = constraint.ValueRangeConstraint(0, MAX) + # CMS Attribute for representing signing time in BinaryTime id_aa_binarySigningTime = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.46') - class BinarySigningTime(BinaryTime): pass + + +# Map of Attribute Type OIDs to Attributes +# To be added to the ones that are in rfc5652.py + +cmsAttributesMapUpdate = { + id_aa_binarySigningTime: BinarySigningTime(), +} diff --git a/pyasn1_modules/rfc6402.py b/pyasn1_modules/rfc6402.py index 7c9f862..2c847a0 100644 --- a/pyasn1_modules/rfc6402.py +++ b/pyasn1_modules/rfc6402.py @@ -3,18 +3,22 @@ # This file is part of pyasn1-modules software. # # Created by Stanisław Pitucha with asn1ate tool. +# Modified by Russ Housley to add a maps for CMC Control Attributes +# and CMC Content Types for use with opentypes. +# # Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pyasn1/license.html # # Certificate Management over CMS (CMC) Updates # # ASN.1 source from: -# http://www.ietf.org/rfc/rfc6402.txt +# https://www.rfc-editor.org/rfc/rfc6402.txt # from pyasn1.type import char from pyasn1.type import constraint from pyasn1.type import namedtype from pyasn1.type import namedval +from pyasn1.type import opentype from pyasn1.type import tag from pyasn1.type import univ from pyasn1.type import useful @@ -37,6 +41,9 @@ def _buildOid(*components): return univ.ObjectIdentifier(output) +cmcControlAttributesMap = { } + + class ChangeSubjectName(univ.Sequence): pass @@ -384,7 +391,9 @@ class TaggedAttribute(univ.Sequence): TaggedAttribute.componentType = namedtype.NamedTypes( namedtype.NamedType('bodyPartID', BodyPartID()), namedtype.NamedType('attrType', univ.ObjectIdentifier()), - namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue())) + namedtype.NamedType('attrValues', univ.SetOf(componentType=AttributeValue()), + openType=opentype.OpenType('attrType', cmcControlAttributesMap) + ) ) @@ -565,3 +574,51 @@ class NoSignatureValue(univ.OctetString): id_ad_cmc = _buildOid(rfc5280.id_ad, 12) id_alg_noSignature = _buildOid(id_pkix, 6, 2) + + +# Map of CMC Control OIDs to CMC Control Attributes + +_cmcControlAttributesMapUpdate = { + id_cmc_statusInfo: CMCStatusInfo(), + id_cmc_statusInfoV2: CMCStatusInfoV2(), + id_cmc_identification: char.UTF8String(), + id_cmc_identityProof: univ.OctetString(), + id_cmc_identityProofV2: IdentifyProofV2(), + id_cmc_dataReturn: univ.OctetString(), + id_cmc_transactionId: univ.Integer(), + id_cmc_senderNonce: univ.OctetString(), + id_cmc_recipientNonce: univ.OctetString(), + id_cmc_addExtensions: AddExtensions(), + id_cmc_encryptedPOP: EncryptedPOP(), + id_cmc_decryptedPOP: DecryptedPOP(), + id_cmc_lraPOPWitness: LraPopWitness(), + id_cmc_getCert: GetCert(), + id_cmc_getCRL: GetCRL(), + id_cmc_revokeRequest: RevokeRequest(), + id_cmc_regInfo: univ.OctetString(), + id_cmc_responseInfo: univ.OctetString(), + id_cmc_queryPending: univ.OctetString(), + id_cmc_popLinkRandom: univ.OctetString(), + id_cmc_popLinkWitness: univ.OctetString(), + id_cmc_popLinkWitnessV2: PopLinkWitnessV2(), + id_cmc_confirmCertAcceptance: CMCCertId(), + id_cmc_trustedAnchors: PublishTrustAnchors(), + id_cmc_authData: AuthPublish(), + id_cmc_batchRequests: BodyPartList(), + id_cmc_batchResponses: BodyPartList(), + id_cmc_publishCert: CMCPublicationInfo(), + id_cmc_modCertTemplate: ModCertTemplate(), + id_cmc_controlProcessed: ControlsProcessed(), + id_ExtensionReq: ExtensionReq(), +} + +cmcControlAttributesMap.update(_cmcControlAttributesMapUpdate) + + +# Map of CMC Content Type OIDs to CMC Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_cct_PKIData: PKIData(), + id_cct_PKIResponse: PKIResponse(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc7191.py b/pyasn1_modules/rfc7191.py index d3e2f85..167f17a 100644 --- a/pyasn1_modules/rfc7191.py +++ b/pyasn1_modules/rfc7191.py @@ -1,7 +1,9 @@ # This file is being contributed to of pyasn1-modules software. # # Created by Russ Housley without assistance from the asn1ate tool. -# Copyright (c) 2018, Vigil Security, LLC +# Modified by Russ Housley to add support for opentypes. +# +# Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html # # CMS Key Package Receipt and Error Content Types @@ -12,10 +14,12 @@ from pyasn1.type import constraint from pyasn1.type import namedtype from pyasn1.type import namedval +from pyasn1.type import opentype from pyasn1.type import tag from pyasn1.type import univ from pyasn1_modules import rfc5280 +from pyasn1_modules import rfc5652 MAX = float('inf') @@ -41,7 +45,9 @@ class SingleAttribute(univ.Sequence): SingleAttribute.componentType = namedtype.NamedTypes( namedtype.NamedType('attrType', univ.ObjectIdentifier()), - namedtype.NamedType('attrValues', AttributeValues()) + namedtype.NamedType('attrValues', AttributeValues(), + openType=opentype.OpenType('attrType', rfc5652.cmsAttributesMap) + ) ) @@ -232,3 +238,20 @@ KeyPkgIdentifierAndReceiptReq.componentType = namedtype.NamedTypes( namedtype.NamedType('pkgID', KeyPkgID()), namedtype.OptionalNamedType('receiptReq', KeyPkgReceiptReq()) ) + + +# Map of Attribute Type OIDs to Attributes +# To be added to the ones that are in rfc5652.py + +cmsAttributesMapUpdate = { + id_aa_KP_keyPkgIdAndReceiptReq: KeyPkgIdentifierAndReceiptReq(), +} + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_KP_keyPackageError: KeyPackageError(), + id_ct_KP_keyPackageReceipt: KeyPackageReceipt(), +}
\ No newline at end of file diff --git a/pyasn1_modules/rfc8226.py b/pyasn1_modules/rfc8226.py index 1f18389..b7df0b5 100644 --- a/pyasn1_modules/rfc8226.py +++ b/pyasn1_modules/rfc8226.py @@ -1,7 +1,8 @@ # This file is being contributed to pyasn1-modules software. # # Created by Russ Housley with assistance from the asn1ate tool, with manual -# changes to implement appropriate constraints and added comments +# changes to implement appropriate constraints and added comments. +# Modified by Russ Housley to add maps for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -17,6 +18,7 @@ from pyasn1.type import namedtype from pyasn1.type import tag from pyasn1.type import univ + MAX = float('inf') @@ -38,43 +40,44 @@ class JWTClaimName(char.IA5String): class JWTClaimNames(univ.SequenceOf): pass - JWTClaimNames.componentType = JWTClaimName() -JWTClaimNames.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) +JWTClaimNames.subtypeSpec=constraint.ValueSizeConstraint(1, MAX) class JWTClaimPermittedValues(univ.Sequence): pass - JWTClaimPermittedValues.componentType = namedtype.NamedTypes( namedtype.NamedType('claim', JWTClaimName()), - namedtype.NamedType('permitted', univ.SequenceOf(componentType=char.UTF8String()).subtype( - subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) + namedtype.NamedType('permitted', univ.SequenceOf( + componentType=char.UTF8String()).subtype( + subtypeSpec=constraint.ValueSizeConstraint(1, MAX))) ) class JWTClaimPermittedValuesList(univ.SequenceOf): pass - JWTClaimPermittedValuesList.componentType = JWTClaimPermittedValues() -JWTClaimPermittedValuesList.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) +JWTClaimPermittedValuesList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX) class JWTClaimConstraints(univ.Sequence): pass - JWTClaimConstraints.componentType = namedtype.NamedTypes( - namedtype.OptionalNamedType('mustInclude', JWTClaimNames().subtype( - explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), - namedtype.OptionalNamedType('permittedValues', JWTClaimPermittedValuesList().subtype( - explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) + namedtype.OptionalNamedType('mustInclude', + JWTClaimNames().subtype(explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatSimple, 0))), + namedtype.OptionalNamedType('permittedValues', + JWTClaimPermittedValuesList().subtype(explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatSimple, 1))) ) + JWTClaimConstraints.sizeSpec = univ.Sequence.sizeSpec + constraint.ValueSizeConstraint(1, 2) + id_pe_JWTClaimConstraints = _OID(1, 3, 6, 1, 5, 5, 7, 1, 27) @@ -85,44 +88,57 @@ class ServiceProviderCode(char.IA5String): class TelephoneNumber(char.IA5String): pass - TelephoneNumber.subtypeSpec = constraint.ConstraintsIntersection( constraint.ValueSizeConstraint(1, 15), - constraint.PermittedAlphabetConstraint('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '#', '*') + constraint.PermittedAlphabetConstraint( + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '#', '*') ) class TelephoneNumberRange(univ.Sequence): pass - TelephoneNumberRange.componentType = namedtype.NamedTypes( namedtype.NamedType('start', TelephoneNumber()), - namedtype.NamedType('count', univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(2, MAX))) + namedtype.NamedType('count', + univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(2, MAX))) ) class TNEntry(univ.Choice): pass - TNEntry.componentType = namedtype.NamedTypes( - namedtype.NamedType('spc', ServiceProviderCode().subtype( - explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), - namedtype.NamedType('range', TelephoneNumberRange().subtype( - explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1))), + namedtype.NamedType('spc', + ServiceProviderCode().subtype(explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatSimple, 0))), + namedtype.NamedType('range', + TelephoneNumberRange().subtype(explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatConstructed, 1))), namedtype.NamedType('one', - TelephoneNumber().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 2))) + TelephoneNumber().subtype(explicitTag=tag.Tag(tag.tagClassContext, + tag.tagFormatSimple, 2))) ) class TNAuthorizationList(univ.SequenceOf): pass - TNAuthorizationList.componentType = TNEntry() -TNAuthorizationList.subtypeSpec = constraint.ValueSizeConstraint(1, MAX) +TNAuthorizationList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX) + 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 + +certificateExtensionsMapUpdate = { + id_pe_TNAuthList: TNAuthorizationList(), + id_pe_JWTClaimConstraints: JWTClaimConstraints(), +} + diff --git a/pyasn1_modules/rfc8520.py b/pyasn1_modules/rfc8520.py index 7bac2f1..8e4adf3 100644 --- a/pyasn1_modules/rfc8520.py +++ b/pyasn1_modules/rfc8520.py @@ -2,6 +2,7 @@ # This file is part of pyasn1-modules software. # # Created by Russ Housley with assistance from asn1ate v.0.6.0. +# Modified by Russ Housley to add maps for use with opentypes. # # Copyright (c) 2019, Vigil Security, LLC # License: http://snmplabs.com/pyasn1/license.html @@ -36,3 +37,20 @@ class MUDsignerSyntax(rfc5280.Name): # Object Identifier for CMS Content Type for a MUD file id_ct_mudtype = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.41') + + +# Map of Certificate Extension OIDs to Extensions +# To be added to the ones that are in rfc5280.py + +certificateExtensionsMapUpdate = { + id_pe_mud_url: MUDURLSyntax(), + id_pe_mudsigner: MUDsignerSyntax(), +} + + +# Map of Content Type OIDs to Content Types +# To be added to the ones that are in rfc5652.py + +cmsContentTypesMapUpdate = { + id_ct_mudtype: univ.OctetString(), +}
\ No newline at end of file |