Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rfc7894.py93 linesDownload Raw Back to pyasn1_modules
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# Alternative Challenge Password Attributes for EST10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc7894.txt13#14 15from pyasn1.type import char16from pyasn1.type import constraint17from pyasn1.type import namedtype18from pyasn1.type import univ19 20from pyasn1_modules import rfc565221from pyasn1_modules import rfc640222from pyasn1_modules import rfc719123 24 25# SingleAttribute is the same as Attribute in RFC 5652, except that the26# attrValues SET must have one and only one member27 28Attribute = rfc7191.SingleAttribute29 30 31# DirectoryString is the same as RFC 5280, except the length is limited to 25532 33class DirectoryString(univ.Choice):34    pass35 36DirectoryString.componentType = namedtype.NamedTypes(37    namedtype.NamedType('teletexString', char.TeletexString().subtype(38        subtypeSpec=constraint.ValueSizeConstraint(1, 255))),39    namedtype.NamedType('printableString', char.PrintableString().subtype(40        subtypeSpec=constraint.ValueSizeConstraint(1, 255))),41    namedtype.NamedType('universalString', char.UniversalString().subtype(42        subtypeSpec=constraint.ValueSizeConstraint(1, 255))),43    namedtype.NamedType('utf8String', char.UTF8String().subtype(44        subtypeSpec=constraint.ValueSizeConstraint(1, 255))),45    namedtype.NamedType('bmpString', char.BMPString().subtype(46        subtypeSpec=constraint.ValueSizeConstraint(1, 255)))47)48 49 50# OTP Challenge Attribute51 52id_aa_otpChallenge = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.56')53 54ub_aa_otpChallenge = univ.Integer(255)55 56otpChallenge = Attribute()57otpChallenge['attrType'] = id_aa_otpChallenge58otpChallenge['attrValues'][0] = DirectoryString()59 60 61# Revocation Challenge Attribute62 63id_aa_revocationChallenge = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.57')64 65ub_aa_revocationChallenge = univ.Integer(255)66 67revocationChallenge = Attribute()68revocationChallenge['attrType'] = id_aa_revocationChallenge69revocationChallenge['attrValues'][0] = DirectoryString()70 71 72#  EST Identity Linking Attribute73 74id_aa_estIdentityLinking = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.58')75 76ub_aa_est_identity_linking = univ.Integer(255)77 78estIdentityLinking = Attribute()79estIdentityLinking['attrType'] = id_aa_estIdentityLinking80estIdentityLinking['attrValues'][0] = DirectoryString()81 82 83# Map of Attribute Type OIDs to Attributes added to the84# ones that are in rfc6402.py85 86_cmcControlAttributesMapUpdate = {87    id_aa_otpChallenge: DirectoryString(),88    id_aa_revocationChallenge: DirectoryString(),89    id_aa_estIdentityLinking: DirectoryString(),90}91 92rfc6402.cmcControlAttributesMap.update(_cmcControlAttributesMapUpdate)93 
codekingpro/portable-devtools · Team Ai