Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rfc5636.py114 linesDownload Raw Back to pyasn1_modules
1# This file is being contributed to pyasn1-modules software.2#3# Created by Russ Housley.4#5# Copyright (c) 2019, Vigil Security, LLC6# License: http://snmplabs.com/pyasn1/license.html7#8# Traceable Anonymous Certificate9#10# ASN.1 source from:11# https://www.rfc-editor.org/rfc/rfc5480.txt12 13from pyasn1.type import namedtype14from pyasn1.type import univ15from pyasn1.type import useful16 17from pyasn1_modules import rfc565218 19 20# Imports from RFC 565221 22ContentInfo = rfc5652.ContentInfo23 24EncapsulatedContentInfo = rfc5652.EncapsulatedContentInfo25 26id_data = rfc5652.id_data27 28 29# Object Identifiers30 31id_KISA = univ.ObjectIdentifier((1, 2, 410, 200004,))32 33 34id_npki = id_KISA + (10,)35 36 37id_attribute = id_npki + (1,)38 39 40id_kisa_tac = id_attribute + (1,)41 42 43id_kisa_tac_token = id_kisa_tac + (1,)44 45 46id_kisa_tac_tokenandblindbash = id_kisa_tac + (2,)47 48 49id_kisa_tac_tokenandpartially = id_kisa_tac + (3,)50 51 52# Structures for Traceable Anonymous Certificate (TAC)53 54class UserKey(univ.OctetString):55    pass56 57 58class Timeout(useful.GeneralizedTime):59    pass60 61 62class BlinedCertificateHash(univ.OctetString):63    pass64 65 66class PartiallySignedCertificateHash(univ.OctetString):67    pass68 69 70class Token(ContentInfo):71    pass72 73 74class TokenandBlindHash(ContentInfo):75    pass76 77 78class TokenandPartiallySignedCertificateHash(ContentInfo):79    pass80 81 82# Added to the module in RFC 5636 for the CMS Content Type Map83 84class TACToken(univ.Sequence):85    componentType = namedtype.NamedTypes(86        namedtype.NamedType('userKey', UserKey()),87        namedtype.NamedType('timeout', Timeout())88    )89 90 91class TACTokenandBlindHash(univ.Sequence):92    componentType = namedtype.NamedTypes(93        namedtype.NamedType('token', Token()),94        namedtype.NamedType('blinded', BlinedCertificateHash())95    )96 97 98class TACTokenandPartiallySignedCertificateHash(univ.Sequence):99    componentType = namedtype.NamedTypes(100        namedtype.NamedType('token', Token()),101        namedtype.NamedType('partially', PartiallySignedCertificateHash())102    )103 104 105# Add to the CMS Content Type Map in rfc5752.py106 107_cmsContentTypesMapUpdate = {108    id_kisa_tac_token: TACToken(),109    id_kisa_tac_tokenandblindbash: TACTokenandBlindHash(),110    id_kisa_tac_tokenandpartially: TACTokenandPartiallySignedCertificateHash(),111}112 113rfc5652.cmsContentTypesMap.update(_cmsContentTypesMapUpdate)114 
codekingpro/portable-devtools · Team Ai