1# This file is being contributed to pyasn1-modules software.
2#
3# Created by Russ Housley.
4#
5# Copyright (c) 2019, Vigil Security, LLC
6# License: http://snmplabs.com/pyasn1/license.html
7#
8# Edwards-Curve Digital Signature Algorithm (EdDSA) Signatures in the CMS
9#
10# ASN.1 source from:
11# https://www.rfc-editor.org/rfc/rfc8419.txt
12# https://www.rfc-editor.org/errata/eid5869
13
14
15from pyasn1.type import univ
16
17from pyasn1_modules import rfc5280
18
19
20class ShakeOutputLen(univ.Integer):
21    pass
22
23
24id_Ed25519 = univ.ObjectIdentifier('1.3.101.112')
25
26sigAlg_Ed25519 = rfc5280.AlgorithmIdentifier()
27sigAlg_Ed25519['algorithm'] = id_Ed25519
28# sigAlg_Ed25519['parameters'] is absent
29
30
31id_Ed448 = univ.ObjectIdentifier('1.3.101.113')
32
33sigAlg_Ed448 = rfc5280.AlgorithmIdentifier()
34sigAlg_Ed448['algorithm'] = id_Ed448
35# sigAlg_Ed448['parameters'] is absent
36
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_sha512
44# hashAlg_SHA_512['parameters'] is absent
45
46
47id_shake256 = hashAlgs + (12, )
48
49hashAlg_SHAKE256 = rfc5280.AlgorithmIdentifier()
50hashAlg_SHAKE256['algorithm'] = id_shake256
51# hashAlg_SHAKE256['parameters']is absent
52
53
54id_shake256_len = hashAlgs + (18, )
55
56hashAlg_SHAKE256_LEN  = rfc5280.AlgorithmIdentifier()
57hashAlg_SHAKE256_LEN['algorithm'] = id_shake256_len
58hashAlg_SHAKE256_LEN['parameters'] = ShakeOutputLen()
59
60
61# Map of Algorithm Identifier OIDs to Parameters added to the
62# 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