aboutsummaryrefslogtreecommitdiff
path: root/pyasn1_modules
diff options
context:
space:
mode:
authorRuss Housley <housley@vigilsec.com>2019-04-25 02:11:01 -0400
committerIlya Etingof <etingof@gmail.com>2019-04-25 08:11:01 +0200
commit000324619fc355b266a18f65e964198b9c60ae47 (patch)
treec208bee8264e4dd3c736b8e216e619dc55cc63b2 /pyasn1_modules
parentda1d7725e07ded77b35522670f684e740bcc67aa (diff)
downloadpyasn1-modules-000324619fc355b266a18f65e964198b9c60ae47.tar.gz
Add RFC3560, RFC5649, and RFC6019 (#28)
Diffstat (limited to 'pyasn1_modules')
-rw-r--r--pyasn1_modules/rfc3560.py85
-rw-r--r--pyasn1_modules/rfc5649.py (renamed from pyasn1_modules/rfc3565.py)23
-rw-r--r--pyasn1_modules/rfc6019.py31
3 files changed, 124 insertions, 15 deletions
diff --git a/pyasn1_modules/rfc3560.py b/pyasn1_modules/rfc3560.py
new file mode 100644
index 0000000..fedb42c
--- /dev/null
+++ b/pyasn1_modules/rfc3560.py
@@ -0,0 +1,85 @@
+#
+# This file is part of pyasn1-modules software.
+#
+# Created by Russ Housley.
+#
+# Copyright (c) 2019, Vigil Security, LLC
+# License: http://snmplabs.com/pyasn1/license.html
+#
+# RSAES-OAEP Key Transport Algorithm in CMS
+#
+# Notice that all of the things needed in RFC 3560 are also defined
+# in RFC 4055. So, they are all pulled from the RFC 4055 module into
+# this one so that people looking a RFC 3560 can easily find them.
+#
+# ASN.1 source from:
+# https://www.rfc-editor.org/rfc/rfc3560.txt
+#
+
+from pyasn1.type import univ, char, namedtype, namedval, tag, constraint, useful
+from pyasn1_modules import rfc4055
+
+
+id_sha1 = rfc4055.id_sha1
+
+id_sha256 = rfc4055.id_sha256
+
+id_sha384 = rfc4055.id_sha384
+
+id_sha512 = rfc4055.id_sha512
+
+
+id_mgf1 = rfc4055.id_mgf1
+
+
+rsaEncryption = rfc4055.rsaEncryption
+
+id_RSAES_OAEP = rfc4055.id_RSAES_OAEP
+
+
+id_pSpecified = rfc4055.id_pSpecified
+
+
+sha1Identifier = rfc4055.sha1Identifier
+
+sha256Identifier = rfc4055.sha256Identifier
+
+sha384Identifier = rfc4055.sha384Identifier
+
+sha512Identifier = rfc4055.sha512Identifier
+
+
+mgf1SHA1Identifier = rfc4055.mgf1SHA1Identifier
+
+mgf1SHA256Identifier = rfc4055.mgf1SHA256Identifier
+
+mgf1SHA384Identifier = rfc4055.mgf1SHA384Identifier
+
+mgf1SHA512Identifier = rfc4055.mgf1SHA512Identifier
+
+
+pSpecifiedEmptyIdentifier = rfc4055.pSpecifiedEmptyIdentifier
+
+
+class RSAES_OAEP_params(rfc4055.RSAES_OAEP_params):
+ pass
+
+
+rSAES_OAEP_Default_Params = RSAES_OAEP_params()
+
+rSAES_OAEP_Default_Identifier = rfc4055.rSAES_OAEP_Default_Identifier
+
+
+rSAES_OAEP_SHA256_Params = rfc4055.rSAES_OAEP_SHA256_Params
+
+rSAES_OAEP_SHA256_Identifier = rfc4055.rSAES_OAEP_SHA256_Identifier
+
+
+rSAES_OAEP_SHA384_Params = rfc4055.rSAES_OAEP_SHA384_Params
+
+rSAES_OAEP_SHA384_Identifier = rfc4055.rSAES_OAEP_SHA384_Identifier
+
+
+rSAES_OAEP_SHA512_Params = rfc4055.rSAES_OAEP_SHA512_Params
+
+rSAES_OAEP_SHA512_Identifier = rfc4055.rSAES_OAEP_SHA512_Identifier
diff --git a/pyasn1_modules/rfc3565.py b/pyasn1_modules/rfc5649.py
index 0833480..292bf1e 100644
--- a/pyasn1_modules/rfc3565.py
+++ b/pyasn1_modules/rfc5649.py
@@ -5,11 +5,10 @@
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
-# Use of the Elliptic Curve Diffie-Hellman Key Agreement Algorithm
-# with X25519 and X448 in the Cryptographic Message Syntax (CMS)
+# AES Key Wrap with Padding
#
# ASN.1 source from:
-# https://www.rfc-editor.org/rfc/rfc3565.txt
+# https://www.rfc-editor.org/rfc/rfc5649.txt
from pyasn1.type import univ, constraint
@@ -21,21 +20,15 @@ class AlgorithmIdentifier(rfc5280.AlgorithmIdentifier):
pass
-class AES_IV(univ.OctetString):
- pass
-
-AES_IV.subtypeSpec = constraint.ValueSizeConstraint(16, 16)
-
-
-id_aes128_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.2')
+id_aes128_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.5')
-id_aes192_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.22')
+id_aes192_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.25')
-id_aes256_CBC = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.42')
+id_aes256_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.45')
-id_aes128_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.5')
+id_aes128_wrap_pad = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.8')
-id_aes192_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.25')
+id_aes192_wrap_pad = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.28')
-id_aes256_wrap = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.45')
+id_aes256_wrap_pad = univ.ObjectIdentifier('2.16.840.1.101.3.4.1.48')
diff --git a/pyasn1_modules/rfc6019.py b/pyasn1_modules/rfc6019.py
new file mode 100644
index 0000000..301c633
--- /dev/null
+++ b/pyasn1_modules/rfc6019.py
@@ -0,0 +1,31 @@
+# This file is being contributed to pyasn1-modules software.
+#
+# Created by Russ Housley.
+#
+# Copyright (c) 2019, Vigil Security, LLC
+# License: http://snmplabs.com/pyasn1/license.html
+#
+# BinaryTime: An Alternate Format for Representing Date and Time
+#
+# ASN.1 source from:
+# https://www.rfc-editor.org/rfc/rfc6019.txt
+
+from pyasn1.type import univ, constraint
+
+MAX = float('inf')
+
+
+# BinaryTime: Represent date and time as an integer
+
+class BinaryTime(univ.Integer):
+ pass
+
+BinaryTime.subtypeSpec = constraint.ValueRangeConstraint(0, MAX)
+
+
+# CMS Attribute for representing signing time in BinaryTime
+
+id_aa_binarySigningTime = univ.ObjectIdentifier('1.2.840.113549.1.9.16.2.46')
+
+class BinarySigningTime(BinaryTime):
+ pass