Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rfc6482.py75 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#6# Copyright (c) 2019, Vigil Security, LLC7# License: http://snmplabs.com/pyasn1/license.html8#9# RPKI Route Origin Authorizations (ROAs)10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc6482.txt13# https://www.rfc-editor.org/errata/eid588114#15 16from pyasn1.type import constraint17from pyasn1.type import namedtype18from pyasn1.type import tag19from pyasn1.type import univ20 21from pyasn1_modules import rfc565222 23MAX = float('inf')24 25 26id_ct_routeOriginAuthz = univ.ObjectIdentifier('1.2.840.113549.1.9.16.1.24')27 28 29class ASID(univ.Integer):30    pass31 32 33class IPAddress(univ.BitString):34    pass35 36 37class ROAIPAddress(univ.Sequence):38    componentType = namedtype.NamedTypes(39        namedtype.NamedType('address', IPAddress()),40        namedtype.OptionalNamedType('maxLength', univ.Integer())41    )42 43 44class ROAIPAddressFamily(univ.Sequence):45    componentType = namedtype.NamedTypes(46        namedtype.NamedType('addressFamily',47            univ.OctetString().subtype(48                subtypeSpec=constraint.ValueSizeConstraint(2, 3))),49        namedtype.NamedType('addresses',50            univ.SequenceOf(componentType=ROAIPAddress()).subtype(51                subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))52    )53 54 55class RouteOriginAttestation(univ.Sequence):56    componentType = namedtype.NamedTypes(57        namedtype.DefaultedNamedType('version',58            univ.Integer().subtype(explicitTag=tag.Tag(59                tag.tagClassContext, tag.tagFormatSimple, 0)).subtype(value=0)),60        namedtype.NamedType('asID', ASID()),61        namedtype.NamedType('ipAddrBlocks',62            univ.SequenceOf(componentType=ROAIPAddressFamily()).subtype(63                subtypeSpec=constraint.ValueSizeConstraint(1, MAX)))64    )65 66 67# Map of Content Type OIDs to Content Types added to the68# ones that are in rfc5652.py69 70_cmsContentTypesMapUpdate = {71    id_ct_routeOriginAuthz: RouteOriginAttestation(),72}73 74rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)75