large CMS update.

most of cms is now implemented


svn path=/trunk/; revision=11518
This commit is contained in:
Ronnie Sahlberg 2004-07-25 10:34:07 +00:00
parent a4ab30088a
commit 2d069de8b4
6 changed files with 952 additions and 128 deletions

View File

@ -74,115 +74,115 @@ Attribute ::= SEQUENCE {
SignatureValue ::= OCTET STRING
-- EnvelopedData ::= SEQUENCE {
-- version CMSVersion,
-- originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
-- recipientInfos RecipientInfos,
-- encryptedContentInfo EncryptedContentInfo,
-- unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
--
-- OriginatorInfo ::= SEQUENCE {
-- certs [0] IMPLICIT CertificateSet OPTIONAL,
--OK crls [1] IMPLICIT CertificateRevocationLists OPTIONAL }
--
-- RecipientInfos ::= SET OF RecipientInfo
--
-- EncryptedContentInfo ::= SEQUENCE {
-- contentType ContentType,
-- contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
-- encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
--
-- EncryptedContent ::= OCTET STRING
--
-- UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
--
-- RecipientInfo ::= CHOICE {
-- ktri KeyTransRecipientInfo,
-- kari [1] KeyAgreeRecipientInfo,
-- kekri [2] KEKRecipientInfo }
--
-- EncryptedKey ::= OCTET STRING
--
-- KeyTransRecipientInfo ::= SEQUENCE {
-- version CMSVersion,
EnvelopedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
OriginatorInfo ::= SEQUENCE {
certs [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL }
RecipientInfos ::= SET OF RecipientInfo
EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
EncryptedContent ::= OCTET STRING
UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
RecipientInfo ::= CHOICE {
ktri KeyTransRecipientInfo,
kari [1] KeyAgreeRecipientInfo,
kekri [2] KEKRecipientInfo }
EncryptedKey ::= OCTET STRING
KeyTransRecipientInfo ::= SEQUENCE {
version CMSVersion,
-- always set to 0 or 2
--OK rid RecipientIdentifier,
-- keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
-- encryptedKey EncryptedKey }
rid RecipientIdentifier,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey }
RecipientIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier }
-- KeyAgreeRecipientInfo ::= SEQUENCE {
-- version CMSVersion,
KeyAgreeRecipientInfo ::= SEQUENCE {
version CMSVersion,
-- always set to 3
-- originator [0] EXPLICIT OriginatorIdentifierOrKey,
-- ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
-- keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
-- recipientEncryptedKeys RecipientEncryptedKeys }
--
-- OriginatorIdentifierOrKey ::= CHOICE {
--OK issuerAndSerialNumber IssuerAndSerialNumber,
--OK subjectKeyIdentifier [0] SubjectKeyIdentifier,
-- originatorKey [1] OriginatorPublicKey }
--
-- OriginatorPublicKey ::= SEQUENCE {
-- algorithm AlgorithmIdentifier,
-- publicKey BIT STRING }
--
-- RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey
--
-- RecipientEncryptedKey ::= SEQUENCE {
--OK rid KeyAgreeRecipientIdentifier,
-- encryptedKey EncryptedKey }
--
-- KeyAgreeRecipientIdentifier ::= CHOICE {
--OK issuerAndSerialNumber IssuerAndSerialNumber,
-- rKeyId [0] IMPLICIT RecipientKeyIdentifier }
--
-- RecipientKeyIdentifier ::= SEQUENCE {
--OK subjectKeyIdentifier SubjectKeyIdentifier,
-- date GeneralizedTime OPTIONAL,
-- other OtherKeyAttribute OPTIONAL }
originator [0] EXPLICIT OriginatorIdentifierOrKey,
ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
recipientEncryptedKeys RecipientEncryptedKeys }
OriginatorIdentifierOrKey ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier [0] SubjectKeyIdentifier,
originatorKey [1] OriginatorPublicKey }
OriginatorPublicKey ::= SEQUENCE {
algorithm AlgorithmIdentifier,
publicKey BIT STRING }
RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey
RecipientEncryptedKey ::= SEQUENCE {
rid KeyAgreeRecipientIdentifier,
encryptedKey EncryptedKey }
KeyAgreeRecipientIdentifier ::= CHOICE {
issuerAndSerialNumber IssuerAndSerialNumber,
rKeyId [0] IMPLICIT RecipientKeyIdentifier }
RecipientKeyIdentifier ::= SEQUENCE {
subjectKeyIdentifier SubjectKeyIdentifier,
date GeneralizedTime OPTIONAL,
other OtherKeyAttribute OPTIONAL }
SubjectKeyIdentifier ::= OCTET STRING
-- KEKRecipientInfo ::= SEQUENCE {
-- version CMSVersion,
KEKRecipientInfo ::= SEQUENCE {
version CMSVersion,
-- always set to 4
-- kekid KEKIdentifier,
-- keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
-- encryptedKey EncryptedKey }
--
-- KEKIdentifier ::= SEQUENCE {
-- keyIdentifier OCTET STRING,
-- date GeneralizedTime OPTIONAL,
-- other OtherKeyAttribute OPTIONAL }
--
-- DigestedData ::= SEQUENCE {
--OK version CMSVersion,
--OK digestAlgorithm DigestAlgorithmIdentifier,
--OK encapContentInfo EncapsulatedContentInfo,
--OK digest Digest }
kekid KEKIdentifier,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey }
KEKIdentifier ::= SEQUENCE {
keyIdentifier OCTET STRING,
date GeneralizedTime OPTIONAL,
other OtherKeyAttribute OPTIONAL }
DigestedData ::= SEQUENCE {
version CMSVersion,
digestAlgorithm DigestAlgorithmIdentifier,
encapContentInfo EncapsulatedContentInfo,
digest Digest }
Digest ::= OCTET STRING
-- EncryptedData ::= SEQUENCE {
-- version CMSVersion,
-- encryptedContentInfo EncryptedContentInfo,
-- unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
--
-- AuthenticatedData ::= SEQUENCE {
-- version CMSVersion,
-- originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
-- recipientInfos RecipientInfos,
-- macAlgorithm MessageAuthenticationCodeAlgorithm,
--OK digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
--OK encapContentInfo EncapsulatedContentInfo,
-- authenticatedAttributes [2] IMPLICIT AuthAttributes OPTIONAL,
-- mac MessageAuthenticationCode,
-- unauthenticatedAttributes [3] IMPLICIT UnauthAttributes OPTIONAL }
EncryptedData ::= SEQUENCE {
version CMSVersion,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
AuthenticatedData ::= SEQUENCE {
version CMSVersion,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
macAlgorithm MessageAuthenticationCodeAlgorithm,
digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
encapContentInfo EncapsulatedContentInfo,
authenticatedAttributes [2] IMPLICIT AuthAttributes OPTIONAL,
mac MessageAuthenticationCode,
unauthenticatedAttributes [3] IMPLICIT UnauthAttributes OPTIONAL }
AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
@ -215,13 +215,14 @@ IssuerAndSerialNumber ::= SEQUENCE {
CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4) }
-- UserKeyingMaterial ::= OCTET STRING
--
-- OtherKeyAttribute ::= SEQUENCE {
-- keyAttrId OBJECT IDENTIFIER,
-- keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
--
--
UserKeyingMaterial ::= OCTET STRING
-- Implemented by hand in the template
OtherKeyAttribute ::= SEQUENCE {
-- keyAttrId OBJECT IDENTIFIER,
-- keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
}
-- CMS Attributes
--
-- MessageDigest ::= OCTET STRING

View File

@ -10,8 +10,10 @@ AuthenticationFramework x509af
#.EXPORTS
SignedData
Countersignature
#.NO_EMIT
OtherKeyAttribute
#.TYPE_RENAME

View File

@ -43,25 +43,89 @@
/* Initialize the protocol and registered fields */
int proto_cms = -1;
static int hf_cms_keyAttr_id = -1;
#include "packet-cms-hf.c"
/* Initialize the subtree pointers */
#include "packet-cms-ett.c"
static int dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
#include "packet-cms-fn.c"
static char keyAttr_id[64]; /*64 chars should be long enough? */
static int
dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
hf_cms_keyAttr_id, keyAttr_id);
return offset;
}
static int
dissect_keyAttr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset=call_ber_oid_callback(keyAttr_id, tvb, offset, pinfo, tree);
return offset;
}
static ber_sequence OtherKeyAttribute_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId },
{ BER_CLASS_ANY, 0, 0, dissect_keyAttr_type },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute);
return offset;
}
static void
dissect_cms_SignedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_SignedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_EnvelopedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_EnvelopedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_DigestedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_DigestedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_EncryptedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_EncryptedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_AuthenticatedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_AuthenticatedData(FALSE, tvb, 0, pinfo, tree, -1);
}
/*--- proto_register_cms ----------------------------------------------*/
void proto_register_cms(void) {
/* List of fields */
static hf_register_info hf[] = {
{ &hf_cms_keyAttr_id,
{ "keyAttr_id", "cms.keyAttr_id",
FT_STRING, BASE_NONE, NULL, 0,
"keyAttr_id", HFILL }},
#include "packet-cms-hfarr.c"
};
@ -83,5 +147,9 @@ void proto_register_cms(void) {
/*--- proto_reg_handoff_cms -------------------------------------------*/
void proto_reg_handoff_cms(void) {
register_ber_oid_dissector("1.2.840.113549.1.7.2", dissect_cms_SignedData_callback, proto_cms, "id-signedData");
register_ber_oid_dissector("1.2.840.113549.1.7.3", dissect_cms_EnvelopedData_callback, proto_cms, "id-envelopedData");
register_ber_oid_dissector("1.2.840.113549.1.7.5", dissect_cms_DigestedData_callback, proto_cms, "id-digestedData");
register_ber_oid_dissector("1.2.840.113549.1.7.6", dissect_cms_EncryptedData_callback, proto_cms, "id-encryptedData");
register_ber_oid_dissector("1.2.840.113549.1.9.16.1.2", dissect_cms_AuthenticatedData_callback, proto_cms, "id-ct-authenticatedData");
}

View File

@ -1,5 +1,23 @@
#.IMPORT_TAG
Certificate BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
AlgorithmIdentifier BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
AttributeCertificate BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
AttributeCertificateAssertion BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
AttributeCertificationPath BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
Certificate BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
CertificateSerialNumber BER_CLASS_UNI BER_UNI_TAG_INTEGER
Certificates BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
CertificationPath BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
CertificateList BER_CLASS_UNI BER_UNI_TAG_SEQUENCE
#.END
#.TYPE_ATTR
Certificate TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
CertificateSerialNumber TYPE = FT_INT32 DISPLAY = BASE_DEC STRINGS = NULL BITMASK = 0
Certificates TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
CertificationPath TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
CertificateList TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
AttributeCertificationPath TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
AttributeCertificate TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
AttributeCertificateAssertion TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0
#.END

View File

@ -51,6 +51,7 @@
/* Initialize the protocol and registered fields */
int proto_cms = -1;
static int hf_cms_keyAttr_id = -1;
/*--- Included file: packet-cms-hf.c ---*/
@ -80,6 +81,40 @@ static int hf_cms_subjectKeyIdentifier = -1; /* SubjectKeyIdentifier */
static int hf_cms_SignedAttributes_item = -1; /* Attribute */
static int hf_cms_UnsignedAttributes_item = -1; /* Attribute */
static int hf_cms_attrType = -1; /* OBJECT_IDENTIFIER */
static int hf_cms_originatorInfo = -1; /* OriginatorInfo */
static int hf_cms_recipientInfos = -1; /* RecipientInfos */
static int hf_cms_encryptedContentInfo = -1; /* EncryptedContentInfo */
static int hf_cms_unprotectedAttrs = -1; /* UnprotectedAttributes */
static int hf_cms_certs = -1; /* CertificateSet */
static int hf_cms_RecipientInfos_item = -1; /* RecipientInfo */
static int hf_cms_contentType = -1; /* ContentType */
static int hf_cms_contentEncryptionAlgorithm = -1; /* ContentEncryptionAlgorithmIdentifier */
static int hf_cms_encryptedContent = -1; /* EncryptedContent */
static int hf_cms_UnprotectedAttributes_item = -1; /* Attribute */
static int hf_cms_ktri = -1; /* KeyTransRecipientInfo */
static int hf_cms_kari = -1; /* KeyAgreeRecipientInfo */
static int hf_cms_kekri = -1; /* KEKRecipientInfo */
static int hf_cms_rid = -1; /* RecipientIdentifier */
static int hf_cms_keyEncryptionAlgorithm = -1; /* KeyEncryptionAlgorithmIdentifier */
static int hf_cms_encryptedKey = -1; /* EncryptedKey */
static int hf_cms_originator = -1; /* OriginatorIdentifierOrKey */
static int hf_cms_ukm = -1; /* UserKeyingMaterial */
static int hf_cms_recipientEncryptedKeys = -1; /* RecipientEncryptedKeys */
static int hf_cms_originatorKey = -1; /* OriginatorPublicKey */
static int hf_cms_algorithm = -1; /* AlgorithmIdentifier */
static int hf_cms_publicKey = -1; /* BIT_STRING */
static int hf_cms_RecipientEncryptedKeys_item = -1; /* RecipientEncryptedKey */
static int hf_cms_rid1 = -1; /* KeyAgreeRecipientIdentifier */
static int hf_cms_rKeyId = -1; /* RecipientKeyIdentifier */
static int hf_cms_date = -1; /* GeneralizedTime */
static int hf_cms_other = -1; /* OtherKeyAttribute */
static int hf_cms_kekid = -1; /* KEKIdentifier */
static int hf_cms_keyIdentifier = -1; /* OCTET_STRING */
static int hf_cms_digest = -1; /* Digest */
static int hf_cms_macAlgorithm = -1; /* MessageAuthenticationCodeAlgorithm */
static int hf_cms_authenticatedAttributes = -1; /* AuthAttributes */
static int hf_cms_mac = -1; /* MessageAuthenticationCode */
static int hf_cms_unauthenticatedAttributes = -1; /* UnauthAttributes */
static int hf_cms_AuthAttributes_item = -1; /* Attribute */
static int hf_cms_UnauthAttributes_item = -1; /* Attribute */
static int hf_cms_CertificateRevocationLists_item = -1; /* CertificateList */
@ -113,19 +148,42 @@ static gint ett_cms_SignerIdentifier = -1;
static gint ett_cms_SignedAttributes = -1;
static gint ett_cms_UnsignedAttributes = -1;
static gint ett_cms_Attribute = -1;
static gint ett_cms_EnvelopedData = -1;
static gint ett_cms_OriginatorInfo = -1;
static gint ett_cms_RecipientInfos = -1;
static gint ett_cms_EncryptedContentInfo = -1;
static gint ett_cms_UnprotectedAttributes = -1;
static gint ett_cms_RecipientInfo = -1;
static gint ett_cms_KeyTransRecipientInfo = -1;
static gint ett_cms_RecipientIdentifier = -1;
static gint ett_cms_KeyAgreeRecipientInfo = -1;
static gint ett_cms_OriginatorIdentifierOrKey = -1;
static gint ett_cms_OriginatorPublicKey = -1;
static gint ett_cms_RecipientEncryptedKeys = -1;
static gint ett_cms_RecipientEncryptedKey = -1;
static gint ett_cms_KeyAgreeRecipientIdentifier = -1;
static gint ett_cms_RecipientKeyIdentifier = -1;
static gint ett_cms_KEKRecipientInfo = -1;
static gint ett_cms_KEKIdentifier = -1;
static gint ett_cms_DigestedData = -1;
static gint ett_cms_EncryptedData = -1;
static gint ett_cms_AuthenticatedData = -1;
static gint ett_cms_AuthAttributes = -1;
static gint ett_cms_UnauthAttributes = -1;
static gint ett_cms_CertificateRevocationLists = -1;
static gint ett_cms_CertificateChoices = -1;
static gint ett_cms_CertificateSet = -1;
static gint ett_cms_IssuerAndSerialNumber = -1;
static gint ett_cms_OtherKeyAttribute = -1;
static gint ett_cms_ExtendedCertificate = -1;
static gint ett_cms_ExtendedCertificateInfo = -1;
/*--- End of included file: packet-cms-ett.c ---*/
static int dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
/*--- Included file: packet-cms-fn.c ---*/
@ -134,6 +192,9 @@ static gint ett_cms_ExtendedCertificateInfo = -1;
/* packet-cms-fn.c */
/* ../../tools/asn2eth.py -X -b -p cms -c cms.cnf -s packet-cms-template CryptographicMessageSyntax.asn */
static int dissect_algorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_algorithm);
}
static int dissect_CertificateRevocationLists_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_CertificateList(FALSE, tvb, offset, pinfo, tree, hf_cms_CertificateRevocationLists_item);
}
@ -157,6 +218,9 @@ dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa
static int dissect_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_ContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_eContentType);
}
static int dissect_contentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_ContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_contentType);
}
static const value_string CMSVersion_vals[] = {
@ -219,6 +283,9 @@ dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, p
static int dissect_eContent(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
}
static int dissect_keyIdentifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_keyIdentifier);
}
static ber_sequence EncapsulatedContentInfo_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_eContentType },
@ -267,6 +334,9 @@ static int dissect_SignedAttributes_item(packet_info *pinfo, proto_tree *tree, t
static int dissect_UnsignedAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_UnsignedAttributes_item);
}
static int dissect_UnprotectedAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_UnprotectedAttributes_item);
}
static int dissect_AuthAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_AuthAttributes_item);
}
@ -285,6 +355,9 @@ dissect_cms_UnauthAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offse
return offset;
}
static int dissect_unauthenticatedAttributes_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_UnauthAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_unauthenticatedAttributes);
}
static int dissect_attributes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_UnauthAttributes(FALSE, tvb, offset, pinfo, tree, hf_cms_attributes);
}
@ -389,9 +462,12 @@ dissect_cms_CertificateSet(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
static int dissect_certificates_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_CertificateSet(TRUE, tvb, offset, pinfo, tree, hf_cms_certificates);
}
static int dissect_certs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_CertificateSet(TRUE, tvb, offset, pinfo, tree, hf_cms_certs);
}
static ber_sequence CertificateRevocationLists_set_of[1] = {
{ -1 /*imported*/, -1 /*imported*/, BER_FLAGS_NOOWNTAG, dissect_CertificateRevocationLists_item },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_CertificateRevocationLists_item },
};
static int
@ -406,7 +482,7 @@ static int dissect_crls_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
}
static ber_sequence IssuerAndSerialNumber_sequence[] = {
{ -1 /*imported*/, -1 /*imported*/, BER_FLAGS_NOOWNTAG, dissect_serialNumber },
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_serialNumber },
{ 0, 0, 0, NULL }
};
@ -554,6 +630,23 @@ dissect_cms_SignedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pac
return offset;
}
static ber_sequence OriginatorInfo_sequence[] = {
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_certs_impl },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crls_impl },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_OriginatorInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
OriginatorInfo_sequence, hf_index, ett_cms_OriginatorInfo);
return offset;
}
static int dissect_originatorInfo_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_OriginatorInfo(TRUE, tvb, offset, pinfo, tree, hf_cms_originatorInfo);
}
static const value_string RecipientIdentifier_vals[] = {
{ 0, "issuerAndSerialNumber" },
@ -574,6 +667,379 @@ dissect_cms_RecipientIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int of
return offset;
}
static int dissect_rid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_RecipientIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_rid);
}
static int
dissect_cms_KeyEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
return offset;
}
static int dissect_keyEncryptionAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_KeyEncryptionAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_keyEncryptionAlgorithm);
}
static int
dissect_cms_EncryptedKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
NULL);
return offset;
}
static int dissect_encryptedKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_EncryptedKey(FALSE, tvb, offset, pinfo, tree, hf_cms_encryptedKey);
}
static ber_sequence KeyTransRecipientInfo_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_rid },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyEncryptionAlgorithm },
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedKey },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_KeyTransRecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
KeyTransRecipientInfo_sequence, hf_index, ett_cms_KeyTransRecipientInfo);
return offset;
}
static int dissect_ktri(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_KeyTransRecipientInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_ktri);
}
static int
dissect_cms_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
NULL, hf_index, -1,
NULL);
return offset;
}
static int dissect_publicKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_BIT_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_publicKey);
}
static ber_sequence OriginatorPublicKey_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_algorithm },
{ BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_publicKey },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_OriginatorPublicKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
OriginatorPublicKey_sequence, hf_index, ett_cms_OriginatorPublicKey);
return offset;
}
static int dissect_originatorKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_OriginatorPublicKey(FALSE, tvb, offset, pinfo, tree, hf_cms_originatorKey);
}
static const value_string OriginatorIdentifierOrKey_vals[] = {
{ 0, "issuerAndSerialNumber" },
{ 1, "subjectKeyIdentifier" },
{ 2, "originatorKey" },
{ 0, NULL }
};
static ber_choice OriginatorIdentifierOrKey_choice[] = {
{ 0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_issuerAndSerialNumber },
{ 1, BER_CLASS_CON, 0, 0, dissect_subjectKeyIdentifier },
{ 2, BER_CLASS_CON, 1, 0, dissect_originatorKey },
{ 0, 0, 0, 0, NULL }
};
static int
dissect_cms_OriginatorIdentifierOrKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
OriginatorIdentifierOrKey_choice, hf_index, ett_cms_OriginatorIdentifierOrKey);
return offset;
}
static int dissect_originator(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_OriginatorIdentifierOrKey(FALSE, tvb, offset, pinfo, tree, hf_cms_originator);
}
static int
dissect_cms_UserKeyingMaterial(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
NULL);
return offset;
}
static int dissect_ukm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_UserKeyingMaterial(FALSE, tvb, offset, pinfo, tree, hf_cms_ukm);
}
static int
dissect_cms_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_generalized_time(pinfo, tree, tvb, offset, hf_index);
return offset;
}
static int dissect_date(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_cms_date);
}
static int dissect_other(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_OtherKeyAttribute(FALSE, tvb, offset, pinfo, tree, hf_cms_other);
}
static ber_sequence RecipientKeyIdentifier_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_subjectKeyIdentifier },
{ BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_date },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_other },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_RecipientKeyIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
RecipientKeyIdentifier_sequence, hf_index, ett_cms_RecipientKeyIdentifier);
return offset;
}
static int dissect_rKeyId_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_RecipientKeyIdentifier(TRUE, tvb, offset, pinfo, tree, hf_cms_rKeyId);
}
static const value_string KeyAgreeRecipientIdentifier_vals[] = {
{ 0, "issuerAndSerialNumber" },
{ 1, "rKeyId" },
{ 0, NULL }
};
static ber_choice KeyAgreeRecipientIdentifier_choice[] = {
{ 0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_issuerAndSerialNumber },
{ 1, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_rKeyId_impl },
{ 0, 0, 0, 0, NULL }
};
static int
dissect_cms_KeyAgreeRecipientIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
KeyAgreeRecipientIdentifier_choice, hf_index, ett_cms_KeyAgreeRecipientIdentifier);
return offset;
}
static int dissect_rid1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_KeyAgreeRecipientIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_rid1);
}
static ber_sequence RecipientEncryptedKey_sequence[] = {
{ -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_rid1 },
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedKey },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_RecipientEncryptedKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
RecipientEncryptedKey_sequence, hf_index, ett_cms_RecipientEncryptedKey);
return offset;
}
static int dissect_RecipientEncryptedKeys_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_RecipientEncryptedKey(FALSE, tvb, offset, pinfo, tree, hf_cms_RecipientEncryptedKeys_item);
}
static ber_sequence RecipientEncryptedKeys_sequence_of[1] = {
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_RecipientEncryptedKeys_item },
};
static int
dissect_cms_RecipientEncryptedKeys(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
RecipientEncryptedKeys_sequence_of, hf_index, ett_cms_RecipientEncryptedKeys);
return offset;
}
static int dissect_recipientEncryptedKeys(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_RecipientEncryptedKeys(FALSE, tvb, offset, pinfo, tree, hf_cms_recipientEncryptedKeys);
}
static ber_sequence KeyAgreeRecipientInfo_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ BER_CLASS_CON, 0, BER_FLAGS_NOTCHKTAG, dissect_originator },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_ukm },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyEncryptionAlgorithm },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_recipientEncryptedKeys },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_KeyAgreeRecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
KeyAgreeRecipientInfo_sequence, hf_index, ett_cms_KeyAgreeRecipientInfo);
return offset;
}
static int dissect_kari(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_KeyAgreeRecipientInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_kari);
}
static ber_sequence KEKIdentifier_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_keyIdentifier },
{ BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_date },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_other },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_KEKIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
KEKIdentifier_sequence, hf_index, ett_cms_KEKIdentifier);
return offset;
}
static int dissect_kekid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_KEKIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_kekid);
}
static ber_sequence KEKRecipientInfo_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_kekid },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyEncryptionAlgorithm },
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedKey },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_KEKRecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
KEKRecipientInfo_sequence, hf_index, ett_cms_KEKRecipientInfo);
return offset;
}
static int dissect_kekri(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_KEKRecipientInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_kekri);
}
static const value_string RecipientInfo_vals[] = {
{ 0, "ktri" },
{ 1, "kari" },
{ 2, "kekri" },
{ 0, NULL }
};
static ber_choice RecipientInfo_choice[] = {
{ 0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ktri },
{ 1, BER_CLASS_CON, 1, 0, dissect_kari },
{ 2, BER_CLASS_CON, 2, 0, dissect_kekri },
{ 0, 0, 0, 0, NULL }
};
static int
dissect_cms_RecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_choice(pinfo, tree, tvb, offset,
RecipientInfo_choice, hf_index, ett_cms_RecipientInfo);
return offset;
}
static int dissect_RecipientInfos_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_RecipientInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_RecipientInfos_item);
}
static ber_sequence RecipientInfos_set_of[1] = {
{ -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_RecipientInfos_item },
};
static int
dissect_cms_RecipientInfos(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
RecipientInfos_set_of, hf_index, ett_cms_RecipientInfos);
return offset;
}
static int dissect_recipientInfos(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_RecipientInfos(FALSE, tvb, offset, pinfo, tree, hf_cms_recipientInfos);
}
static int
dissect_cms_ContentEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
return offset;
}
static int dissect_contentEncryptionAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_ContentEncryptionAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_contentEncryptionAlgorithm);
}
static int
dissect_cms_EncryptedContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
NULL);
return offset;
}
static int dissect_encryptedContent_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_EncryptedContent(TRUE, tvb, offset, pinfo, tree, hf_cms_encryptedContent);
}
static ber_sequence EncryptedContentInfo_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_contentType },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_contentEncryptionAlgorithm },
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_encryptedContent_impl },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_EncryptedContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
EncryptedContentInfo_sequence, hf_index, ett_cms_EncryptedContentInfo);
return offset;
}
static int dissect_encryptedContentInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_EncryptedContentInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_encryptedContentInfo);
}
static ber_sequence UnprotectedAttributes_set_of[1] = {
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_UnprotectedAttributes_item },
};
static int
dissect_cms_UnprotectedAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
UnprotectedAttributes_set_of, hf_index, ett_cms_UnprotectedAttributes);
return offset;
}
static int dissect_unprotectedAttrs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_UnprotectedAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_unprotectedAttrs);
}
static ber_sequence EnvelopedData_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_originatorInfo_impl },
{ BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_recipientInfos },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encryptedContentInfo },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unprotectedAttrs_impl },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_EnvelopedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
EnvelopedData_sequence, hf_index, ett_cms_EnvelopedData);
return offset;
}
static int
@ -583,6 +1049,51 @@ dissect_cms_Digest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_
return offset;
}
static int dissect_digest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_Digest(FALSE, tvb, offset, pinfo, tree, hf_cms_digest);
}
static ber_sequence DigestedData_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_digestAlgorithm },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encapContentInfo },
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_digest },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_DigestedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
DigestedData_sequence, hf_index, ett_cms_DigestedData);
return offset;
}
static ber_sequence EncryptedData_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encryptedContentInfo },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unprotectedAttrs_impl },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_EncryptedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
EncryptedData_sequence, hf_index, ett_cms_EncryptedData);
return offset;
}
static int
dissect_cms_MessageAuthenticationCodeAlgorithm(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
return offset;
}
static int dissect_macAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_MessageAuthenticationCodeAlgorithm(FALSE, tvb, offset, pinfo, tree, hf_cms_macAlgorithm);
}
static ber_sequence AuthAttributes_set_of[1] = {
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_AuthAttributes_item },
@ -595,6 +1106,9 @@ dissect_cms_AuthAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
return offset;
}
static int dissect_authenticatedAttributes_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_AuthAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_authenticatedAttributes);
}
static int
@ -604,33 +1118,33 @@ dissect_cms_MessageAuthenticationCode(gboolean implicit_tag _U_, tvbuff_t *tvb,
return offset;
}
static int dissect_mac(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_cms_MessageAuthenticationCode(FALSE, tvb, offset, pinfo, tree, hf_cms_mac);
}
static ber_sequence AuthenticatedData_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
{ BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_originatorInfo_impl },
{ BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_recipientInfos },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_macAlgorithm },
{ BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_digestAlgorithm },
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encapContentInfo },
{ BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_authenticatedAttributes_impl },
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_mac },
{ BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unauthenticatedAttributes_impl },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_KeyEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
dissect_cms_AuthenticatedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
AuthenticatedData_sequence, hf_index, ett_cms_AuthenticatedData);
return offset;
}
static int
dissect_cms_ContentEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
return offset;
}
static int
dissect_cms_MessageAuthenticationCodeAlgorithm(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
return offset;
}
static int
int
dissect_cms_Countersignature(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_cms_SignerInfo(implicit_tag, tvb, offset, pinfo, tree, hf_index);
@ -642,17 +1156,77 @@ dissect_cms_Countersignature(gboolean implicit_tag _U_, tvbuff_t *tvb, int offse
static char keyAttr_id[64]; /*64 chars should be long enough? */
static int
dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
hf_cms_keyAttr_id, keyAttr_id);
return offset;
}
static int
dissect_keyAttr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset=call_ber_oid_callback(keyAttr_id, tvb, offset, pinfo, tree);
return offset;
}
static ber_sequence OtherKeyAttribute_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId },
{ BER_CLASS_ANY, 0, 0, dissect_keyAttr_type },
{ 0, 0, 0, NULL }
};
static int
dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute);
return offset;
}
static void
dissect_cms_SignedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_SignedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_EnvelopedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_EnvelopedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_DigestedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_DigestedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_EncryptedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_EncryptedData(FALSE, tvb, 0, pinfo, tree, -1);
}
static void
dissect_cms_AuthenticatedData_callback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
dissect_cms_AuthenticatedData(FALSE, tvb, 0, pinfo, tree, -1);
}
/*--- proto_register_cms ----------------------------------------------*/
void proto_register_cms(void) {
/* List of fields */
static hf_register_info hf[] = {
{ &hf_cms_keyAttr_id,
{ "keyAttr_id", "cms.keyAttr_id",
FT_STRING, BASE_NONE, NULL, 0,
"keyAttr_id", HFILL }},
/*--- Included file: packet-cms-hfarr.c ---*/
@ -672,7 +1246,7 @@ void proto_register_cms(void) {
{ &hf_cms_encapContentInfo,
{ "encapContentInfo", "cms.encapContentInfo",
FT_NONE, BASE_NONE, NULL, 0,
"SignedData/encapContentInfo", HFILL }},
"", HFILL }},
{ &hf_cms_certificates,
{ "certificates", "cms.certificates",
FT_UINT32, BASE_DEC, NULL, 0,
@ -680,7 +1254,7 @@ void proto_register_cms(void) {
{ &hf_cms_crls,
{ "crls", "cms.crls",
FT_UINT32, BASE_DEC, NULL, 0,
"SignedData/crls", HFILL }},
"", HFILL }},
{ &hf_cms_signerInfos,
{ "signerInfos", "cms.signerInfos",
FT_UINT32, BASE_DEC, NULL, 0,
@ -708,7 +1282,7 @@ void proto_register_cms(void) {
{ &hf_cms_digestAlgorithm,
{ "digestAlgorithm", "cms.digestAlgorithm",
FT_NONE, BASE_NONE, NULL, 0,
"SignerInfo/digestAlgorithm", HFILL }},
"", HFILL }},
{ &hf_cms_signedAttrs,
{ "signedAttrs", "cms.signedAttrs",
FT_UINT32, BASE_DEC, NULL, 0,
@ -745,6 +1319,142 @@ void proto_register_cms(void) {
{ "attrType", "cms.attrType",
FT_STRING, BASE_NONE, NULL, 0,
"Attribute/attrType", HFILL }},
{ &hf_cms_originatorInfo,
{ "originatorInfo", "cms.originatorInfo",
FT_NONE, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_cms_recipientInfos,
{ "recipientInfos", "cms.recipientInfos",
FT_UINT32, BASE_DEC, NULL, 0,
"", HFILL }},
{ &hf_cms_encryptedContentInfo,
{ "encryptedContentInfo", "cms.encryptedContentInfo",
FT_NONE, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_cms_unprotectedAttrs,
{ "unprotectedAttrs", "cms.unprotectedAttrs",
FT_UINT32, BASE_DEC, NULL, 0,
"", HFILL }},
{ &hf_cms_certs,
{ "certs", "cms.certs",
FT_UINT32, BASE_DEC, NULL, 0,
"OriginatorInfo/certs", HFILL }},
{ &hf_cms_RecipientInfos_item,
{ "Item(##)", "cms.RecipientInfos_item",
FT_UINT32, BASE_DEC, VALS(RecipientInfo_vals), 0,
"RecipientInfos/_item", HFILL }},
{ &hf_cms_contentType,
{ "contentType", "cms.contentType",
FT_STRING, BASE_NONE, NULL, 0,
"EncryptedContentInfo/contentType", HFILL }},
{ &hf_cms_contentEncryptionAlgorithm,
{ "contentEncryptionAlgorithm", "cms.contentEncryptionAlgorithm",
FT_NONE, BASE_NONE, NULL, 0,
"EncryptedContentInfo/contentEncryptionAlgorithm", HFILL }},
{ &hf_cms_encryptedContent,
{ "encryptedContent", "cms.encryptedContent",
FT_BYTES, BASE_HEX, NULL, 0,
"EncryptedContentInfo/encryptedContent", HFILL }},
{ &hf_cms_UnprotectedAttributes_item,
{ "Item(##)", "cms.UnprotectedAttributes_item",
FT_NONE, BASE_NONE, NULL, 0,
"UnprotectedAttributes/_item", HFILL }},
{ &hf_cms_ktri,
{ "ktri", "cms.ktri",
FT_NONE, BASE_NONE, NULL, 0,
"RecipientInfo/ktri", HFILL }},
{ &hf_cms_kari,
{ "kari", "cms.kari",
FT_NONE, BASE_NONE, NULL, 0,
"RecipientInfo/kari", HFILL }},
{ &hf_cms_kekri,
{ "kekri", "cms.kekri",
FT_NONE, BASE_NONE, NULL, 0,
"RecipientInfo/kekri", HFILL }},
{ &hf_cms_rid,
{ "rid", "cms.rid",
FT_UINT32, BASE_DEC, VALS(RecipientIdentifier_vals), 0,
"KeyTransRecipientInfo/rid", HFILL }},
{ &hf_cms_keyEncryptionAlgorithm,
{ "keyEncryptionAlgorithm", "cms.keyEncryptionAlgorithm",
FT_NONE, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_cms_encryptedKey,
{ "encryptedKey", "cms.encryptedKey",
FT_BYTES, BASE_HEX, NULL, 0,
"", HFILL }},
{ &hf_cms_originator,
{ "originator", "cms.originator",
FT_UINT32, BASE_DEC, VALS(OriginatorIdentifierOrKey_vals), 0,
"KeyAgreeRecipientInfo/originator", HFILL }},
{ &hf_cms_ukm,
{ "ukm", "cms.ukm",
FT_BYTES, BASE_HEX, NULL, 0,
"KeyAgreeRecipientInfo/ukm", HFILL }},
{ &hf_cms_recipientEncryptedKeys,
{ "recipientEncryptedKeys", "cms.recipientEncryptedKeys",
FT_UINT32, BASE_DEC, NULL, 0,
"KeyAgreeRecipientInfo/recipientEncryptedKeys", HFILL }},
{ &hf_cms_originatorKey,
{ "originatorKey", "cms.originatorKey",
FT_NONE, BASE_NONE, NULL, 0,
"OriginatorIdentifierOrKey/originatorKey", HFILL }},
{ &hf_cms_algorithm,
{ "algorithm", "cms.algorithm",
FT_NONE, BASE_NONE, NULL, 0,
"OriginatorPublicKey/algorithm", HFILL }},
{ &hf_cms_publicKey,
{ "publicKey", "cms.publicKey",
FT_BYTES, BASE_HEX, NULL, 0,
"OriginatorPublicKey/publicKey", HFILL }},
{ &hf_cms_RecipientEncryptedKeys_item,
{ "Item[##]", "cms.RecipientEncryptedKeys_item",
FT_NONE, BASE_NONE, NULL, 0,
"RecipientEncryptedKeys/_item", HFILL }},
{ &hf_cms_rid1,
{ "rid", "cms.rid",
FT_UINT32, BASE_DEC, VALS(KeyAgreeRecipientIdentifier_vals), 0,
"RecipientEncryptedKey/rid", HFILL }},
{ &hf_cms_rKeyId,
{ "rKeyId", "cms.rKeyId",
FT_NONE, BASE_NONE, NULL, 0,
"KeyAgreeRecipientIdentifier/rKeyId", HFILL }},
{ &hf_cms_date,
{ "date", "cms.date",
FT_STRING, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_cms_other,
{ "other", "cms.other",
FT_NONE, BASE_NONE, NULL, 0,
"", HFILL }},
{ &hf_cms_kekid,
{ "kekid", "cms.kekid",
FT_NONE, BASE_NONE, NULL, 0,
"KEKRecipientInfo/kekid", HFILL }},
{ &hf_cms_keyIdentifier,
{ "keyIdentifier", "cms.keyIdentifier",
FT_BYTES, BASE_HEX, NULL, 0,
"KEKIdentifier/keyIdentifier", HFILL }},
{ &hf_cms_digest,
{ "digest", "cms.digest",
FT_BYTES, BASE_HEX, NULL, 0,
"DigestedData/digest", HFILL }},
{ &hf_cms_macAlgorithm,
{ "macAlgorithm", "cms.macAlgorithm",
FT_NONE, BASE_NONE, NULL, 0,
"AuthenticatedData/macAlgorithm", HFILL }},
{ &hf_cms_authenticatedAttributes,
{ "authenticatedAttributes", "cms.authenticatedAttributes",
FT_UINT32, BASE_DEC, NULL, 0,
"AuthenticatedData/authenticatedAttributes", HFILL }},
{ &hf_cms_mac,
{ "mac", "cms.mac",
FT_BYTES, BASE_HEX, NULL, 0,
"AuthenticatedData/mac", HFILL }},
{ &hf_cms_unauthenticatedAttributes,
{ "unauthenticatedAttributes", "cms.unauthenticatedAttributes",
FT_UINT32, BASE_DEC, NULL, 0,
"AuthenticatedData/unauthenticatedAttributes", HFILL }},
{ &hf_cms_AuthAttributes_item,
{ "Item(##)", "cms.AuthAttributes_item",
FT_NONE, BASE_NONE, NULL, 0,
@ -775,7 +1485,7 @@ void proto_register_cms(void) {
"CertificateSet/_item", HFILL }},
{ &hf_cms_serialNumber,
{ "serialNumber", "cms.serialNumber",
FT_NONE, BASE_NONE, NULL, 0,
FT_INT32, BASE_DEC, NULL, 0,
"IssuerAndSerialNumber/serialNumber", HFILL }},
{ &hf_cms_extendedCertificateInfo,
{ "extendedCertificateInfo", "cms.extendedCertificateInfo",
@ -813,13 +1523,33 @@ void proto_register_cms(void) {
&ett_cms_SignedAttributes,
&ett_cms_UnsignedAttributes,
&ett_cms_Attribute,
&ett_cms_EnvelopedData,
&ett_cms_OriginatorInfo,
&ett_cms_RecipientInfos,
&ett_cms_EncryptedContentInfo,
&ett_cms_UnprotectedAttributes,
&ett_cms_RecipientInfo,
&ett_cms_KeyTransRecipientInfo,
&ett_cms_RecipientIdentifier,
&ett_cms_KeyAgreeRecipientInfo,
&ett_cms_OriginatorIdentifierOrKey,
&ett_cms_OriginatorPublicKey,
&ett_cms_RecipientEncryptedKeys,
&ett_cms_RecipientEncryptedKey,
&ett_cms_KeyAgreeRecipientIdentifier,
&ett_cms_RecipientKeyIdentifier,
&ett_cms_KEKRecipientInfo,
&ett_cms_KEKIdentifier,
&ett_cms_DigestedData,
&ett_cms_EncryptedData,
&ett_cms_AuthenticatedData,
&ett_cms_AuthAttributes,
&ett_cms_UnauthAttributes,
&ett_cms_CertificateRevocationLists,
&ett_cms_CertificateChoices,
&ett_cms_CertificateSet,
&ett_cms_IssuerAndSerialNumber,
&ett_cms_OtherKeyAttribute,
&ett_cms_ExtendedCertificate,
&ett_cms_ExtendedCertificateInfo,
@ -840,5 +1570,9 @@ void proto_register_cms(void) {
/*--- proto_reg_handoff_cms -------------------------------------------*/
void proto_reg_handoff_cms(void) {
register_ber_oid_dissector("1.2.840.113549.1.7.2", dissect_cms_SignedData_callback, proto_cms, "id-signedData");
register_ber_oid_dissector("1.2.840.113549.1.7.3", dissect_cms_EnvelopedData_callback, proto_cms, "id-envelopedData");
register_ber_oid_dissector("1.2.840.113549.1.7.5", dissect_cms_DigestedData_callback, proto_cms, "id-digestedData");
register_ber_oid_dissector("1.2.840.113549.1.7.6", dissect_cms_EncryptedData_callback, proto_cms, "id-encryptedData");
register_ber_oid_dissector("1.2.840.113549.1.9.16.1.2", dissect_cms_AuthenticatedData_callback, proto_cms, "id-ct-authenticatedData");
}

View File

@ -42,6 +42,7 @@
/* ../../tools/asn2eth.py -X -b -p cms -c cms.cnf -s packet-cms-template CryptographicMessageSyntax.asn */
int dissect_cms_SignedData(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
int dissect_cms_Countersignature(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
/*--- End of included file: packet-cms-exp.h ---*/