diff options
author | Graeme Lunt <graeme.lunt@smhs.co.uk> | 2007-01-28 10:20:51 +0000 |
---|---|---|
committer | Graeme Lunt <graeme.lunt@smhs.co.uk> | 2007-01-28 10:20:51 +0000 |
commit | c4b562e9880a9e9d3ad1ef7ff357a5ae52225550 (patch) | |
tree | 9b5d98938648365dea002909403d9ea5d3992c7c /asn1 | |
parent | 7edc7aea68854c30fd42cc5576c1021fcb4c4480 (diff) |
Support for SMIMECapabilities and KeyPreference attributes.
ContentInfo syntax for .p7s, .p7c and .p7m files.
svn path=/trunk/; revision=20585
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/cms/CryptographicMessageSyntax.asn | 53 | ||||
-rw-r--r-- | asn1/cms/cms.cnf | 37 | ||||
-rw-r--r-- | asn1/cms/packet-cms-template.c | 9 |
3 files changed, 85 insertions, 14 deletions
diff --git a/asn1/cms/CryptographicMessageSyntax.asn b/asn1/cms/CryptographicMessageSyntax.asn index 9159116e67..ad96da8ff7 100644 --- a/asn1/cms/CryptographicMessageSyntax.asn +++ b/asn1/cms/CryptographicMessageSyntax.asn @@ -276,20 +276,20 @@ Countersignature ::= SignerInfo -- -- Algorithm Parameters -- --- KeyWrapAlgorithm ::= AlgorithmIdentifier --- --- RC2wrapParameter ::= RC2ParameterVersion --- --- RC2ParameterVersion ::= INTEGER --- --- CBCParameter ::= IV --- --- IV ::= OCTET STRING --- --- RC2CBCParameter ::= SEQUENCE { --- rc2ParameterVersion INTEGER, --- iv OCTET STRING } --- +KeyWrapAlgorithm ::= AlgorithmIdentifier + +RC2WrapParameter ::= RC2ParameterVersion + +RC2ParameterVersion ::= INTEGER + +CBCParameter ::= IV + +IV ::= OCTET STRING + +RC2CBCParameter ::= SEQUENCE { + rc2ParameterVersion INTEGER, + iv OCTET STRING } + -- -- Content Type Object Identifiers -- @@ -346,5 +346,30 @@ ExtendedCertificateInfo ::= SEQUENCE { Signature ::= BIT STRING +-- From S/MIME + +SMIMECapabilities ::= SEQUENCE OF SMIMECapability + +SMIMECapability ::= SEQUENCE { + capability OBJECT IDENTIFIER, + parameters ANY OPTIONAL +} + +SMIMEEncryptionKeyPreference ::= CHOICE { + issuerAndSerialNumber [0] IssuerAndSerialNumber, + recipientKeyId [1] RecipientKeyIdentifier, + subjectAltKeyIdentifier [2] SubjectKeyIdentifier + +} + +-- some implememtations do not seem to use the RC2CBCParameter with 1.2.840.113549.3.2 as per RFC 2630 12.4.2 +-- so we create this CHOICE to workaround this problem until we understand what is really the correct solution + +RC2CBCParameters ::= CHOICE { + rc2WrapParameter RC2WrapParameter, + rc2CBCParameter RC2CBCParameter + +} + END -- of CryptographicMessageSyntax diff --git a/asn1/cms/cms.cnf b/asn1/cms/cms.cnf index 853c5e0bf0..3623f83c93 100644 --- a/asn1/cms/cms.cnf +++ b/asn1/cms/cms.cnf @@ -40,6 +40,13 @@ Countersignature B "1.2.840.113549.1.9.6" "id-counterSignature" ContentInfo B "2.6.1.4.18" "id-et-pkcs7" +IssuerAndSerialNumber B "1.3.6.1.4.1.311.16.4" "ms-oe-encryption-key-preference" +SMIMECapabilities B "1.2.840.113549.1.9.15" "id-smime-capabilities" +SMIMEEncryptionKeyPreference B "1.2.840.113549.1.9.16.2.11" "id-encryption-key-preference" + +# I think the following should be RC2CBCParameter - but that appears to be incorrect +RC2CBCParameters B "1.2.840.113549.3.2" "id-alg-rc2-cbc" +RC2WrapParameter B "1.2.840.113549.1.9.16.3.7" "id-alg-cmsrc2-wrap" #.NO_EMIT #.TYPE_RENAME @@ -129,6 +136,36 @@ EncryptedContentInfo/contentType encryptedContentType if(content_tvb) cms_verify_msg_digest(pi, content_tvb, x509af_get_last_algorithm_id(), tvb, old_offset); +#.FN_PARS SMIMECapability/capability + FN_VARIANT = _str HF_INDEX = hf_cms_attrType VAL_PTR = &object_identifier_id + +#.FN_BODY SMIMECapability/capability + const char *name = NULL; + + %(DEFAULT_BODY)s + + if(object_identifier_id) { + name = get_oid_str_name(object_identifier_id); + proto_item_append_text(tree, " %%s", name ? name : object_identifier_id); + cap_tree = tree; + } + +#.FN_BODY T_parameters + + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree); + + +#.FN_PARS RC2ParameterVersion + VAL_PTR = &length + +#.FN_BODY RC2ParameterVersion + guint32 length = 0; + + %(DEFAULT_BODY)s + + if(cap_tree != NULL) + proto_item_append_text(cap_tree, " (%%d bits)", length); + #.END diff --git a/asn1/cms/packet-cms-template.c b/asn1/cms/packet-cms-template.c index 6ceb9da072..315ee5d732 100644 --- a/asn1/cms/packet-cms-template.c +++ b/asn1/cms/packet-cms-template.c @@ -62,6 +62,7 @@ static const char *object_identifier_id; static tvbuff_t *content_tvb = NULL; static proto_tree *top_tree=NULL; +static proto_tree *cap_tree=NULL; #define HASH_SHA1 "1.3.14.3.2.26" #define SHA1_BUFFER_SIZE 20 @@ -156,6 +157,12 @@ void proto_register_cms(void) { proto_register_field_array(proto_cms, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + register_ber_syntax_dissector("ContentInfo", proto_cms, dissect_ContentInfo_PDU); + register_ber_oid_syntax(".p7s", NULL, "ContentInfo"); + register_ber_oid_syntax(".p7m", NULL, "ContentInfo"); + register_ber_oid_syntax(".p7c", NULL, "ContentInfo"); + + } @@ -164,6 +171,8 @@ void proto_reg_handoff_cms(void) { #include "packet-cms-dis-tab.c" add_oid_str_name("1.2.840.113549.1.7.1", "id-data"); + add_oid_str_name("1.2.840.113549.3.7", "id-alg-des-ede3-cbc"); + add_oid_str_name("1.3.14.3.2.7", "id-alg-des-cbc"); } |