codekingpro/portable-devtools
114k
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# Edwards-Curve Digital Signature Algorithm (EdDSA) Signatures in the CMS9#10# ASN.1 source from:11# https://www.rfc-editor.org/rfc/rfc8419.txt12# https://www.rfc-editor.org/errata/eid586913 14 15from pyasn1.type import univ16 17from pyasn1_modules import rfc528018 19 20class ShakeOutputLen(univ.Integer):21 pass22 23 24id_Ed25519 = univ.ObjectIdentifier('1.3.101.112')25 26sigAlg_Ed25519 = rfc5280.AlgorithmIdentifier()27sigAlg_Ed25519['algorithm'] = id_Ed2551928# sigAlg_Ed25519['parameters'] is absent29 30 31id_Ed448 = univ.ObjectIdentifier('1.3.101.113')32 33sigAlg_Ed448 = rfc5280.AlgorithmIdentifier()34sigAlg_Ed448['algorithm'] = id_Ed44835# sigAlg_Ed448['parameters'] is absent36 37 38hashAlgs = univ.ObjectIdentifier('2.16.840.1.101.3.4.2')39 40id_sha512 = hashAlgs + (3, )41 42hashAlg_SHA_512 = rfc5280.AlgorithmIdentifier()43hashAlg_SHA_512['algorithm'] = id_sha51244# hashAlg_SHA_512['parameters'] is absent45 46 47id_shake256 = hashAlgs + (12, )48 49hashAlg_SHAKE256 = rfc5280.AlgorithmIdentifier()50hashAlg_SHAKE256['algorithm'] = id_shake25651# hashAlg_SHAKE256['parameters']is absent52 53 54id_shake256_len = hashAlgs + (18, )55 56hashAlg_SHAKE256_LEN = rfc5280.AlgorithmIdentifier()57hashAlg_SHAKE256_LEN['algorithm'] = id_shake256_len58hashAlg_SHAKE256_LEN['parameters'] = ShakeOutputLen()59 60 61# Map of Algorithm Identifier OIDs to Parameters added to the62# ones in rfc5280.py. Do not add OIDs with absent paramaters.63 64_algorithmIdentifierMapUpdate = {65 id_shake256_len: ShakeOutputLen(),66}67 68rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)69 