codekingpro/portable-devtools
114k
1#2# This file is part of pyasn1-modules software.3#4# Created by Russ Housley.5#6# Copyright (c) 2019, Vigil Security, LLC7# License: http://snmplabs.com/pyasn1/license.html8#9# Clearance Sponsor Attribute10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc5917.txt13# https://www.rfc-editor.org/errata/eid455814# https://www.rfc-editor.org/errata/eid588315#16 17from pyasn1.type import char18from pyasn1.type import constraint19from pyasn1.type import namedtype20from pyasn1.type import univ21 22from pyasn1_modules import rfc528023 24 25# DirectoryString is the same as RFC 5280, except for two things:26# 1. the length is limited to 64;27# 2. only the 'utf8String' choice remains because the ASN.128# specification says: ( WITH COMPONENTS { utf8String PRESENT } )29 30class DirectoryString(univ.Choice):31 componentType = namedtype.NamedTypes(32 namedtype.NamedType('utf8String', char.UTF8String().subtype(33 subtypeSpec=constraint.ValueSizeConstraint(1, 64))),34 )35 36 37# Clearance Sponsor Attribute38 39id_clearanceSponsor = univ.ObjectIdentifier((2, 16, 840, 1, 101, 2, 1, 5, 68))40 41ub_clearance_sponsor = univ.Integer(64)42 43 44at_clearanceSponsor = rfc5280.Attribute()45at_clearanceSponsor['type'] = id_clearanceSponsor46at_clearanceSponsor['values'][0] = DirectoryString()47 48 49# Add to the map of Attribute Type OIDs to Attributes in rfc5280.py.50 51_certificateAttributesMapUpdate = {52 id_clearanceSponsor: DirectoryString(),53}54 55rfc5280.certificateAttributesMap.update(_certificateAttributesMapUpdate)56 