Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rfc6010.py89 linesDownload Raw Back to pyasn1_modules
1#2# This file is part of pyasn1-modules software.3#4# Created by Russ Housley with assistance from asn1ate v.0.6.0.5# Modified by Russ Housley to add maps for use with opentypes.6#7# Copyright (c) 2019, Vigil Security, LLC8# License: http://snmplabs.com/pyasn1/license.html9#10# Certificate Extension for CMS Content Constraints (CCC)11#12# ASN.1 source from:13# https://www.rfc-editor.org/rfc/rfc6010.txt14#15 16from pyasn1.type import constraint17from pyasn1.type import namedtype18from pyasn1.type import namedval19from pyasn1.type import univ20 21from pyasn1_modules import rfc528022 23MAX = float('inf')24 25 26AttributeType = rfc5280.AttributeType27 28AttributeValue = rfc5280.AttributeValue29 30 31id_ct_anyContentType = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.0')32 33 34class AttrConstraint(univ.Sequence):35    pass36 37AttrConstraint.componentType = namedtype.NamedTypes(38    namedtype.NamedType('attrType', AttributeType()),39    namedtype.NamedType('attrValues', univ.SetOf(40        componentType=AttributeValue()).subtype(subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))41)42 43 44class AttrConstraintList(univ.SequenceOf):45    pass46 47AttrConstraintList.componentType = AttrConstraint()48AttrConstraintList.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)49 50 51class ContentTypeGeneration(univ.Enumerated):52    pass53 54ContentTypeGeneration.namedValues = namedval.NamedValues(55    ('canSource', 0),56    ('cannotSource', 1)57)58 59 60class ContentTypeConstraint(univ.Sequence):61    pass62 63ContentTypeConstraint.componentType = namedtype.NamedTypes(64    namedtype.NamedType('contentType', univ.ObjectIdentifier()),65    namedtype.DefaultedNamedType('canSource', ContentTypeGeneration().subtype(value='canSource')),66    namedtype.OptionalNamedType('attrConstraints', AttrConstraintList())67)68 69 70# CMS Content Constraints (CCC) Extension and Object Identifier71 72id_pe_cmsContentConstraints = univ.ObjectIdentifier('1.3.6.1.5.5.7.1.18')73 74class CMSContentConstraints(univ.SequenceOf):75    pass76 77CMSContentConstraints.componentType = ContentTypeConstraint()78CMSContentConstraints.subtypeSpec=constraint.ValueSizeConstraint(1, MAX)79 80 81# Map of Certificate Extension OIDs to Extensions82# To be added to the ones that are in rfc5280.py83 84_certificateExtensionsMap = {85    id_pe_cmsContentConstraints: CMSContentConstraints(),86}87 88rfc5280.certificateExtensionsMap.update(_certificateExtensionsMap)89 
codekingpro/portable-devtools · Team Ai