codekingpro/portable-devtools
114k
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# Subject Identification Method (SIM)10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc4683.txt13# https://www.rfc-editor.org/errata/eid104714#15 16from pyasn1.type import char17from pyasn1.type import namedtype18from pyasn1.type import univ19 20from pyasn1_modules import rfc528021 22 23# Used to compute the PEPSI value24 25class HashContent(univ.Sequence):26 componentType = namedtype.NamedTypes(27 namedtype.NamedType('userPassword', char.UTF8String()),28 namedtype.NamedType('authorityRandom', univ.OctetString()),29 namedtype.NamedType('identifierType', univ.ObjectIdentifier()),30 namedtype.NamedType('identifier', char.UTF8String())31 )32 33 34# Used to encode the PEPSI value as the SIM Other Name35 36id_pkix = rfc5280.id_pkix37 38id_on = id_pkix + (8,)39 40id_on_SIM = id_on + (6,)41 42 43class SIM(univ.Sequence):44 componentType = namedtype.NamedTypes(45 namedtype.NamedType('hashAlg', rfc5280.AlgorithmIdentifier()),46 namedtype.NamedType('authorityRandom', univ.OctetString()),47 namedtype.NamedType('pEPSI', univ.OctetString())48 )49 50 51# Used to encrypt the PEPSI value during certificate request52 53id_pkip = id_pkix + (5,)54 55id_regEPEPSI = id_pkip + (3,)56 57 58class EncryptedPEPSI(univ.Sequence):59 componentType = namedtype.NamedTypes(60 namedtype.NamedType('identifierType', univ.ObjectIdentifier()),61 namedtype.NamedType('identifier', char.UTF8String()),62 namedtype.NamedType('sIM', SIM())63 )64 65 66# Update the map of Other Name OIDs to Other Names in rfc5280.py67 68_anotherNameMapUpdate = {69 id_on_SIM: SIM(),70}71 72rfc5280.anotherNameMap.update(_anotherNameMapUpdate)73 