aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Bond <will@wbond.net>2019-12-25 06:32:39 -0500
committerGitHub <noreply@github.com>2019-12-25 06:32:39 -0500
commit4c75759bdb2d6d36656fea3db9e4d94367483aa6 (patch)
tree3498ec76ac0d75f475ef187c83abec0d7a39fef9
parent53f60e059d5cecc8328cfcccc734ee534ddfb17b (diff)
parent718f290c2161634ba46c1353ce52a03cd46315e2 (diff)
downloadasn1crypto-4c75759bdb2d6d36656fea3db9e4d94367483aa6.tar.gz
Merge pull request #171 from commonism/encrypt_key_pref
add support for id-aa-encrypKeyPref in pkcs7/cms mail signatures
-rw-r--r--asn1crypto/cms.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/asn1crypto/cms.py b/asn1crypto/cms.py
index 1fabc13..2115aed 100644
--- a/asn1crypto/cms.py
+++ b/asn1crypto/cms.py
@@ -100,6 +100,8 @@ class CMSAttributeType(ObjectIdentifier):
'1.2.840.113549.1.9.4': 'message_digest',
'1.2.840.113549.1.9.5': 'signing_time',
'1.2.840.113549.1.9.6': 'counter_signature',
+ # https://tools.ietf.org/html/rfc2633#page-26
+ '1.2.840.113549.1.9.16.2.11': 'encrypt_key_pref',
# https://tools.ietf.org/html/rfc3161#page-20
'1.2.840.113549.1.9.16.2.14': 'signature_time_stamp_token',
# https://tools.ietf.org/html/rfc6211#page-5
@@ -924,6 +926,26 @@ class CompressedData(Sequence):
return self._decompressed
+class RecipientKeyIdentifier(Sequence):
+ _fields = [
+ ('subjectKeyIdentifier', OctetString),
+ ('date', GeneralizedTime, {'optional': True}),
+ ('other', OtherKeyAttribute, {'optional': True}),
+ ]
+
+
+class SMIMEEncryptionKeyPreference(Choice):
+ _alternatives = [
+ ('issuer_and_serial_number', IssuerAndSerialNumber, {'implicit': 0}),
+ ('recipientKeyId', RecipientKeyIdentifier, {'implicit': 1}),
+ ('subjectAltKeyIdentifier', PublicKeyInfo, {'implicit': 2}),
+ ]
+
+
+class SMIMEEncryptionKeyPreferences(SetOf):
+ _child_spec = SMIMEEncryptionKeyPreference
+
+
ContentInfo._oid_specs = {
'data': OctetString,
'signed_data': SignedData,
@@ -958,4 +980,5 @@ CMSAttribute._oid_specs = {
'cms_algorithm_protection': SetOfCMSAlgorithmProtection,
'microsoft_nested_signature': SetOfContentInfo,
'microsoft_time_stamp_token': SetOfContentInfo,
+ 'encrypt_key_pref': SMIMEEncryptionKeyPreferences,
}