diff options
author | Russ Housley <housley@vigilsec.com> | 2019-06-25 16:36:01 -0400 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-06-25 22:36:01 +0200 |
commit | 118dccfd5a18d7b7e48be830fecb0d30ee8b1b7b (patch) | |
tree | 91d0baa709476a4f89deaebfaa2e0ffbdcc54366 | |
parent | fc113ede3a2db3a2fd3932e83295adcd8f158493 (diff) | |
download | pyasn1-modules-118dccfd5a18d7b7e48be830fecb0d30ee8b1b7b.tar.gz |
Add openType support for ORAddress Extension Attributes in rfc5280.py (#47)
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | pyasn1_modules/rfc5280.py | 39 |
2 files changed, 39 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 03c1ba4..48f9f92 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -22,6 +22,8 @@ Revision 0.2.6, released XX-05-2019 - Added RFC8619 providing HKDF Algorithm Identifiers - Added RFC7191 providing CMS Key Package Receipt and Error Content Types +- Added openType support for ORAddress Extension Attributes in + the RFC5280 module Revision 0.2.5, released 24-04-2019 ----------------------------------- diff --git a/pyasn1_modules/rfc5280.py b/pyasn1_modules/rfc5280.py index 80bded5..0bcc31d 100644 --- a/pyasn1_modules/rfc5280.py +++ b/pyasn1_modules/rfc5280.py @@ -3,6 +3,8 @@ # This file is part of pyasn1-modules software. # # Created by Stanisław Pitucha with asn1ate tool. +# Updated by Russ Housley to add openType support for ORAddress Extension Attributes. +# # Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pyasn1/license.html # @@ -10,7 +12,7 @@ # Revocation List (CRL) Profile # # ASN.1 source from: -# http://www.ietf.org/rfc/rfc5280.txt +# https://www.rfc-editor.org/rfc/rfc5280.txt # from pyasn1.type import char from pyasn1.type import constraint @@ -382,7 +384,9 @@ class PhysicalDeliveryOfficeName(PDSParameter): ub_extension_attributes = univ.Integer(256) certificateExtensionsMap = { +} +oraddressExtensionAttributeMap = { } @@ -394,7 +398,7 @@ class ExtensionAttribute(univ.Sequence): namedtype.NamedType( 'extension-attribute-value', univ.Any().subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1)), - openType=opentype.OpenType('type', certificateExtensionsMap)) + openType=opentype.OpenType('extension-attribute-type', oraddressExtensionAttributeMap)) ) id_qt = _buildOid(id_pkix, 2) @@ -1562,6 +1566,37 @@ id_ce_subjectKeyIdentifier = _buildOid(id_ce, 14) id_ce_inhibitAnyPolicy = _buildOid(id_ce, 54) +# map of ORAddress ExtensionAttribute type to ExtensionAttribute value + +_oraddressExtensionAttributeMapUpdate = { + common_name: CommonName(), + teletex_common_name: TeletexCommonName(), + teletex_organization_name: TeletexOrganizationName(), + teletex_personal_name: TeletexPersonalName(), + teletex_organizational_unit_names: TeletexOrganizationalUnitNames(), + pds_name: PDSName(), + physical_delivery_country_name: PhysicalDeliveryCountryName(), + postal_code: PostalCode(), + physical_delivery_office_name: PhysicalDeliveryOfficeName(), + physical_delivery_office_number: PhysicalDeliveryOfficeNumber(), + extension_OR_address_components: ExtensionORAddressComponents(), + physical_delivery_personal_name: PhysicalDeliveryPersonalName(), + physical_delivery_organization_name: PhysicalDeliveryOrganizationName(), + extension_physical_delivery_address_components: ExtensionPhysicalDeliveryAddressComponents(), + unformatted_postal_address: UnformattedPostalAddress(), + street_address: StreetAddress(), + post_office_box_address: PostOfficeBoxAddress(), + poste_restante_address: PosteRestanteAddress(), + unique_postal_name: UniquePostalName(), + local_postal_attributes: LocalPostalAttributes(), + extended_network_address: ExtendedNetworkAddress(), + terminal_type: TerminalType(), + teletex_domain_defined_attributes: TeletexDomainDefinedAttributes(), +} + +oraddressExtensionAttributeMap.update(_oraddressExtensionAttributeMapUpdate) + + # map of AttributeType -> AttributeValue _certificateAttributesMapUpdate = { |