File: rfc6955.py

package info (click to toggle)
python-pyasn1-modules-lextudio 0.2.9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,220 kB
  • sloc: python: 30,857; makefile: 9
file content (147 lines) | stat: -rw-r--r-- 2,869 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: https://www.pysnmp.com/pyasn1/license.html
#
# Diffie-Hellman Proof-of-Possession Algorithms
#
# ASN.1 source from:
# https://www.rfc-editor.org/rfc/rfc6955.txt
#

from pyasn1.type import namedtype, univ

from pyasn1_modules import rfc3279, rfc5280, rfc5652

# Imports from RFC 5652

MessageDigest = rfc5652.MessageDigest

IssuerAndSerialNumber = rfc5652.IssuerAndSerialNumber


# Imports from RFC 5280

id_pkix = rfc5280.id_pkix


# Imports from RFC 3279

Dss_Sig_Value = rfc3279.Dss_Sig_Value

DomainParameters = rfc3279.DomainParameters


# Static DH Proof-of-Possession


class DhSigStatic(univ.Sequence):
    componentType = namedtype.NamedTypes(
        namedtype.OptionalNamedType("issuerAndSerial", IssuerAndSerialNumber()),
        namedtype.NamedType("hashValue", MessageDigest()),
    )


# Object Identifiers

id_dh_sig_hmac_sha1 = id_pkix + (
    6,
    3,
)

id_dhPop_static_sha1_hmac_sha1 = univ.ObjectIdentifier(id_dh_sig_hmac_sha1)


id_alg_dh_pop = id_pkix + (
    6,
    4,
)

id_alg_dhPop_sha1 = univ.ObjectIdentifier(id_alg_dh_pop)

id_alg_dhPop_sha224 = id_pkix + (
    6,
    5,
)

id_alg_dhPop_sha256 = id_pkix + (
    6,
    6,
)

id_alg_dhPop_sha384 = id_pkix + (
    6,
    7,
)

id_alg_dhPop_sha512 = id_pkix + (
    6,
    8,
)


id_alg_dhPop_static_sha224_hmac_sha224 = id_pkix + (
    6,
    15,
)

id_alg_dhPop_static_sha256_hmac_sha256 = id_pkix + (
    6,
    16,
)

id_alg_dhPop_static_sha384_hmac_sha384 = id_pkix + (
    6,
    17,
)

id_alg_dhPop_static_sha512_hmac_sha512 = id_pkix + (
    6,
    18,
)


id_alg_ecdhPop_static_sha224_hmac_sha224 = id_pkix + (
    6,
    25,
)

id_alg_ecdhPop_static_sha256_hmac_sha256 = id_pkix + (
    6,
    26,
)

id_alg_ecdhPop_static_sha384_hmac_sha384 = id_pkix + (
    6,
    27,
)

id_alg_ecdhPop_static_sha512_hmac_sha512 = id_pkix + (
    6,
    28,
)


# Update the Algorithm Identifier map in rfc5280.py

_algorithmIdentifierMapUpdate = {
    id_alg_dh_pop: DomainParameters(),
    id_alg_dhPop_sha224: DomainParameters(),
    id_alg_dhPop_sha256: DomainParameters(),
    id_alg_dhPop_sha384: DomainParameters(),
    id_alg_dhPop_sha512: DomainParameters(),
    id_dh_sig_hmac_sha1: univ.Null(""),
    id_alg_dhPop_static_sha224_hmac_sha224: univ.Null(""),
    id_alg_dhPop_static_sha256_hmac_sha256: univ.Null(""),
    id_alg_dhPop_static_sha384_hmac_sha384: univ.Null(""),
    id_alg_dhPop_static_sha512_hmac_sha512: univ.Null(""),
    id_alg_ecdhPop_static_sha224_hmac_sha224: univ.Null(""),
    id_alg_ecdhPop_static_sha256_hmac_sha256: univ.Null(""),
    id_alg_ecdhPop_static_sha384_hmac_sha384: univ.Null(""),
    id_alg_ecdhPop_static_sha512_hmac_sha512: univ.Null(""),
}

rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)