1# 2# This file is part of pyasn1-modules software. 3# 4# Created by Russ Housley. 5# 6# Copyright (c) 2019, Vigil Security, LLC 7# License: http://snmplabs.com/pyasn1/license.html 8# 9# Clearance Sponsor Attribute 10# 11# ASN.1 source from: 12# https://www.rfc-editor.org/rfc/rfc5917.txt 13# https://www.rfc-editor.org/errata/eid4558 14# https://www.rfc-editor.org/errata/eid5883 15# 16 17from pyasn1.type import char 18from pyasn1.type import constraint 19from pyasn1.type import namedtype 20from pyasn1.type import univ 21 22from pyasn1_modules import rfc5280 23 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.1 28# 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 Attribute 38 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_clearanceSponsor 46at_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