codekingpro/portable-devtools
114k
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# Diffie-Hellman Proof-of-Possession Algorithms10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc6955.txt13#14 15from pyasn1.type import namedtype16from pyasn1.type import univ17 18from pyasn1_modules import rfc327919from pyasn1_modules import rfc528020from pyasn1_modules import rfc565221 22 23# Imports from RFC 565224 25MessageDigest = rfc5652.MessageDigest26 27IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber28 29 30# Imports from RFC 528031 32id_pkix = rfc5280.id_pkix33 34 35# Imports from RFC 327936 37Dss_Sig_Value = rfc3279.Dss_Sig_Value38 39DomainParameters = rfc3279.DomainParameters40 41 42# Static DH Proof-of-Possession43 44class DhSigStatic(univ.Sequence):45 componentType = namedtype.NamedTypes(46 namedtype.OptionalNamedType('issuerAndSerial', IssuerAndSerialNumber()),47 namedtype.NamedType('hashValue', MessageDigest())48 )49 50 51# Object Identifiers52 53id_dh_sig_hmac_sha1 = id_pkix + (6, 3, )54 55id_dhPop_static_sha1_hmac_sha1 = univ.ObjectIdentifier(id_dh_sig_hmac_sha1)56 57 58id_alg_dh_pop = id_pkix + (6, 4, )59 60id_alg_dhPop_sha1 = univ.ObjectIdentifier(id_alg_dh_pop)61 62id_alg_dhPop_sha224 = id_pkix + (6, 5, )63 64id_alg_dhPop_sha256 = id_pkix + (6, 6, )65 66id_alg_dhPop_sha384 = id_pkix + (6, 7, )67 68id_alg_dhPop_sha512 = id_pkix + (6, 8, )69 70 71id_alg_dhPop_static_sha224_hmac_sha224 = id_pkix + (6, 15, )72 73id_alg_dhPop_static_sha256_hmac_sha256 = id_pkix + (6, 16, )74 75id_alg_dhPop_static_sha384_hmac_sha384 = id_pkix + (6, 17, )76 77id_alg_dhPop_static_sha512_hmac_sha512 = id_pkix + (6, 18, )78 79 80id_alg_ecdhPop_static_sha224_hmac_sha224 = id_pkix + (6, 25, )81 82id_alg_ecdhPop_static_sha256_hmac_sha256 = id_pkix + (6, 26, )83 84id_alg_ecdhPop_static_sha384_hmac_sha384 = id_pkix + (6, 27, )85 86id_alg_ecdhPop_static_sha512_hmac_sha512 = id_pkix + (6, 28, )87 88 89# Update the Algorithm Identifier map in rfc5280.py90 91_algorithmIdentifierMapUpdate = {92 id_alg_dh_pop: DomainParameters(),93 id_alg_dhPop_sha224: DomainParameters(),94 id_alg_dhPop_sha256: DomainParameters(),95 id_alg_dhPop_sha384: DomainParameters(),96 id_alg_dhPop_sha512: DomainParameters(),97 id_dh_sig_hmac_sha1: univ.Null(""),98 id_alg_dhPop_static_sha224_hmac_sha224: univ.Null(""),99 id_alg_dhPop_static_sha256_hmac_sha256: univ.Null(""),100 id_alg_dhPop_static_sha384_hmac_sha384: univ.Null(""),101 id_alg_dhPop_static_sha512_hmac_sha512: univ.Null(""),102 id_alg_ecdhPop_static_sha224_hmac_sha224: univ.Null(""),103 id_alg_ecdhPop_static_sha256_hmac_sha256: univ.Null(""),104 id_alg_ecdhPop_static_sha384_hmac_sha384: univ.Null(""),105 id_alg_ecdhPop_static_sha512_hmac_sha512: univ.Null(""),106}107 108rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)109 