Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rfc8702.py106 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) 2020, Vigil Security, LLC7# License: http://snmplabs.com/pyasn1/license.html8#9# SHAKE One-way Hash Functions for CMS10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc8702.txt13#14from pyasn1.type import namedtype15from pyasn1.type import tag16from pyasn1.type import univ17 18from pyasn1_modules import rfc528019from pyasn1_modules import rfc869220 21 22# Imports fprm RFC 528023 24AlgorithmIdentifier = rfc5280.AlgorithmIdentifier25 26 27# Imports from RFC 869228 29id_shake128 = rfc8692.id_shake12830 31mda_shake128 = rfc8692.mda_shake12832 33id_shake256 = rfc8692.id_shake25634 35mda_shake256 = rfc8692.mda_shake25636 37id_RSASSA_PSS_SHAKE128 = rfc8692.id_RSASSA_PSS_SHAKE12838 39sa_rSASSA_PSS_SHAKE128 = rfc8692.sa_rSASSA_PSS_SHAKE12840 41pk_rsaSSA_PSS_SHAKE128 = rfc8692.pk_rsaSSA_PSS_SHAKE12842 43id_RSASSA_PSS_SHAKE256 = rfc8692.id_RSASSA_PSS_SHAKE25644 45sa_rSASSA_PSS_SHAKE256 = rfc8692.sa_rSASSA_PSS_SHAKE25646 47pk_rsaSSA_PSS_SHAKE256 = rfc8692.pk_rsaSSA_PSS_SHAKE25648 49id_ecdsa_with_shake128 = rfc8692.id_ecdsa_with_shake12850 51sa_ecdsa_with_shake128 = rfc8692.sa_ecdsa_with_shake12852 53id_ecdsa_with_shake256 = rfc8692.id_ecdsa_with_shake25654 55sa_ecdsa_with_shake256 = rfc8692.sa_ecdsa_with_shake25656 57pk_ec = rfc8692.pk_ec58 59 60# KMAC with SHAKE12861 62id_KMACWithSHAKE128 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.19')63 64 65class KMACwithSHAKE128_params(univ.Sequence):66    componentType = namedtype.NamedTypes(67        namedtype.DefaultedNamedType('kMACOutputLength',68            univ.Integer().subtype(value=256)),69        namedtype.DefaultedNamedType('customizationString',70            univ.OctetString().subtype(value=''))71    )72 73 74maca_KMACwithSHAKE128 = AlgorithmIdentifier()75maca_KMACwithSHAKE128['algorithm'] = id_KMACWithSHAKE12876maca_KMACwithSHAKE128['parameters'] = KMACwithSHAKE128_params()77 78 79# KMAC with SHAKE25680 81id_KMACWithSHAKE256 = univ.ObjectIdentifier('2.16.840.1.101.3.4.2.20')82 83 84class KMACwithSHAKE256_params(univ.Sequence):85    componentType = namedtype.NamedTypes(86        namedtype.DefaultedNamedType('kMACOutputLength',87            univ.Integer().subtype(value=512)),88        namedtype.DefaultedNamedType('customizationString',89            univ.OctetString().subtype(value=''))90    )91 92 93maca_KMACwithSHAKE256 = AlgorithmIdentifier()94maca_KMACwithSHAKE256['algorithm'] = id_KMACWithSHAKE25695maca_KMACwithSHAKE256['parameters'] = KMACwithSHAKE256_params()96 97 98# Update the Algorithm Identifier map in rfc5280.py99 100_algorithmIdentifierMapUpdate = {101    id_KMACWithSHAKE128: KMACwithSHAKE128_params(),102    id_KMACWithSHAKE256: KMACwithSHAKE256_params(),103}104 105rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)106 
codekingpro/portable-devtools · Team Ai