Debian Codegraph @

third_party/python/pyasn1_modules/pyasn1_modules/rfc3565.py

raw
1 # This file is being contributed to pyasn1-modules software.
2 #
3 # Created by Russ Housley.
4 # Modified by Russ Housley to add maps for use with opentypes.
5 #
6 # Copyright (c) 2019, Vigil Security, LLC
7 # License: http://snmplabs.com/pyasn1/license.html
8 #
9 # Use of the Advanced Encryption Standard (AES) Encryption
10 # Algorithm in the Cryptographic Message Syntax (CMS)
11 #
12 # ASN.1 source from:
13 # https://www.rfc-editor.org/rfc/rfc3565.txt
14
15
16 from pyasn1.type import constraint
17 from pyasn1.type import univ
18
19 from pyasn1_modules import rfc5280
20
21
22 class AlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
23 pass
24
25
26 class AES_IV(univ.OctetString):
27 pass
28
29 AES_IV.subtypeSpec = constraint.ValueSizeConstraint(16, 16)
30
31
32 id_aes128_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.2')
33
34 id_aes192_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.22')
35
36 id_aes256_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.42')
37
38
39 id_aes128_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.5')
40
41 id_aes192_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.25')
42
43 id_aes256_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.45')
44
45
46 # Update the Algorithm Identifier map
47
48 _algorithmIdentifierMapUpdate = {
49 id_aes128_CBC: AES_IV(),
50 id_aes192_CBC: AES_IV(),
51 id_aes256_CBC: AES_IV(),
52 id_aes128_wrap: univ.Null(),
53 id_aes192_wrap: univ.Null(),
54 id_aes256_wrap: univ.Null(),
55 }
56
57 rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)