New protocol: RFC2634 ExtendedSecurityServices
[obnox/wireshark/wip.git] / epan / dissectors / packet-cms.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Ethereal dissector compiler    */
3 /* ./packet-cms.c                                                             */
4 /* ../../tools/asn2eth.py -X -b -k -e -p cms -c cms.cnf -s packet-cms-template CryptographicMessageSyntax.asn */
5
6 /* Input file: packet-cms-template.c */
7
8 /* packet-cms.c
9  * Routines for RFC2630 Cryptographic Message Syntax packet dissection
10  *   Ronnie Sahlberg 2004
11  *
12  * $Id: packet-cms-template.c 12434 2004-10-29 12:11:42Z sahlberg $
13  *
14  * Ethereal - Network traffic analyzer
15  * By Gerald Combs <gerald@ethereal.com>
16  * Copyright 1998 Gerald Combs
17  *
18  * This program is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU General Public License
20  * as published by the Free Software Foundation; either version 2
21  * of the License, or (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
31  */
32
33 #ifdef HAVE_CONFIG_H
34 # include "config.h"
35 #endif
36
37 #include <glib.h>
38 #include <epan/packet.h>
39 #include <epan/conversation.h>
40
41 #include <stdio.h>
42 #include <string.h>
43
44 #include "packet-ber.h"
45 #include "packet-cms.h"
46 #include "packet-x509af.h"
47 #include "packet-x509if.h"
48
49 #define PNAME  "Cryptographic Message Syntax"
50 #define PSNAME "CMS"
51 #define PFNAME "cms"
52
53 /* Initialize the protocol and registered fields */
54 int proto_cms = -1;
55 static int hf_cms_ci_contentType = -1;
56
57 /*--- Included file: packet-cms-hf.c ---*/
58
59 static int hf_cms_SignedData_PDU = -1;            /* SignedData */
60 static int hf_cms_EnvelopedData_PDU = -1;         /* EnvelopedData */
61 static int hf_cms_DigestedData_PDU = -1;          /* DigestedData */
62 static int hf_cms_EncryptedData_PDU = -1;         /* EncryptedData */
63 static int hf_cms_AuthenticatedData_PDU = -1;     /* AuthenticatedData */
64 static int hf_cms_contentType = -1;               /* T_contentType */
65 static int hf_cms_content = -1;                   /* T_content */
66 static int hf_cms_version = -1;                   /* CMSVersion */
67 static int hf_cms_digestAlgorithms = -1;          /* DigestAlgorithmIdentifiers */
68 static int hf_cms_encapContentInfo = -1;          /* EncapsulatedContentInfo */
69 static int hf_cms_certificates = -1;              /* CertificateSet */
70 static int hf_cms_crls = -1;                      /* CertificateRevocationLists */
71 static int hf_cms_signerInfos = -1;               /* SignerInfos */
72 static int hf_cms_DigestAlgorithmIdentifiers_item = -1;  /* DigestAlgorithmIdentifier */
73 static int hf_cms_SignerInfos_item = -1;          /* SignerInfo */
74 static int hf_cms_eContentType = -1;              /* T_eContentType */
75 static int hf_cms_eContent = -1;                  /* T_eContent */
76 static int hf_cms_sid = -1;                       /* SignerIdentifier */
77 static int hf_cms_digestAlgorithm = -1;           /* DigestAlgorithmIdentifier */
78 static int hf_cms_signedAttrs = -1;               /* SignedAttributes */
79 static int hf_cms_signatureAlgorithm = -1;        /* SignatureAlgorithmIdentifier */
80 static int hf_cms_signatureValue = -1;            /* SignatureValue */
81 static int hf_cms_unsignedAttrs = -1;             /* UnsignedAttributes */
82 static int hf_cms_issuerAndSerialNumber = -1;     /* IssuerAndSerialNumber */
83 static int hf_cms_subjectKeyIdentifier = -1;      /* SubjectKeyIdentifier */
84 static int hf_cms_SignedAttributes_item = -1;     /* Attribute */
85 static int hf_cms_UnsignedAttributes_item = -1;   /* Attribute */
86 static int hf_cms_attrType = -1;                  /* OBJECT_IDENTIFIER */
87 static int hf_cms_originatorInfo = -1;            /* OriginatorInfo */
88 static int hf_cms_recipientInfos = -1;            /* RecipientInfos */
89 static int hf_cms_encryptedContentInfo = -1;      /* EncryptedContentInfo */
90 static int hf_cms_unprotectedAttrs = -1;          /* UnprotectedAttributes */
91 static int hf_cms_certs = -1;                     /* CertificateSet */
92 static int hf_cms_RecipientInfos_item = -1;       /* RecipientInfo */
93 static int hf_cms_contentType1 = -1;              /* ContentType */
94 static int hf_cms_contentEncryptionAlgorithm = -1;  /* ContentEncryptionAlgorithmIdentifier */
95 static int hf_cms_encryptedContent = -1;          /* EncryptedContent */
96 static int hf_cms_UnprotectedAttributes_item = -1;  /* Attribute */
97 static int hf_cms_ktri = -1;                      /* KeyTransRecipientInfo */
98 static int hf_cms_kari = -1;                      /* KeyAgreeRecipientInfo */
99 static int hf_cms_kekri = -1;                     /* KEKRecipientInfo */
100 static int hf_cms_rid = -1;                       /* RecipientIdentifier */
101 static int hf_cms_keyEncryptionAlgorithm = -1;    /* KeyEncryptionAlgorithmIdentifier */
102 static int hf_cms_encryptedKey = -1;              /* EncryptedKey */
103 static int hf_cms_originator = -1;                /* OriginatorIdentifierOrKey */
104 static int hf_cms_ukm = -1;                       /* UserKeyingMaterial */
105 static int hf_cms_recipientEncryptedKeys = -1;    /* RecipientEncryptedKeys */
106 static int hf_cms_originatorKey = -1;             /* OriginatorPublicKey */
107 static int hf_cms_algorithm = -1;                 /* AlgorithmIdentifier */
108 static int hf_cms_publicKey = -1;                 /* BIT_STRING */
109 static int hf_cms_RecipientEncryptedKeys_item = -1;  /* RecipientEncryptedKey */
110 static int hf_cms_rekRid = -1;                    /* KeyAgreeRecipientIdentifier */
111 static int hf_cms_rKeyId = -1;                    /* RecipientKeyIdentifier */
112 static int hf_cms_date = -1;                      /* GeneralizedTime */
113 static int hf_cms_other = -1;                     /* OtherKeyAttribute */
114 static int hf_cms_kekid = -1;                     /* KEKIdentifier */
115 static int hf_cms_keyIdentifier = -1;             /* OCTET_STRING */
116 static int hf_cms_digest = -1;                    /* Digest */
117 static int hf_cms_macAlgorithm = -1;              /* MessageAuthenticationCodeAlgorithm */
118 static int hf_cms_authenticatedAttributes = -1;   /* AuthAttributes */
119 static int hf_cms_mac = -1;                       /* MessageAuthenticationCode */
120 static int hf_cms_unauthenticatedAttributes = -1;  /* UnauthAttributes */
121 static int hf_cms_AuthAttributes_item = -1;       /* Attribute */
122 static int hf_cms_UnauthAttributes_item = -1;     /* Attribute */
123 static int hf_cms_CertificateRevocationLists_item = -1;  /* CertificateList */
124 static int hf_cms_certificate = -1;               /* Certificate */
125 static int hf_cms_extendedCertificate = -1;       /* ExtendedCertificate */
126 static int hf_cms_attrCert = -1;                  /* AttributeCertificate */
127 static int hf_cms_CertificateSet_item = -1;       /* CertificateChoices */
128 static int hf_cms_issuer = -1;                    /* Name */
129 static int hf_cms_serialNumber = -1;              /* CertificateSerialNumber */
130 static int hf_cms_keyAttrId = -1;                 /* T_keyAttrId */
131 static int hf_cms_keyAttr = -1;                   /* T_keyAttr */
132 static int hf_cms_extendedCertificateInfo = -1;   /* ExtendedCertificateInfo */
133 static int hf_cms_signature = -1;                 /* Signature */
134 static int hf_cms_attributes = -1;                /* UnauthAttributes */
135
136 /*--- End of included file: packet-cms-hf.c ---*/
137
138
139 /* Initialize the subtree pointers */
140
141 /*--- Included file: packet-cms-ett.c ---*/
142
143 static gint ett_cms_ContentInfo = -1;
144 static gint ett_cms_SignedData = -1;
145 static gint ett_cms_DigestAlgorithmIdentifiers = -1;
146 static gint ett_cms_SignerInfos = -1;
147 static gint ett_cms_EncapsulatedContentInfo = -1;
148 static gint ett_cms_SignerInfo = -1;
149 static gint ett_cms_SignerIdentifier = -1;
150 static gint ett_cms_SignedAttributes = -1;
151 static gint ett_cms_UnsignedAttributes = -1;
152 static gint ett_cms_Attribute = -1;
153 static gint ett_cms_EnvelopedData = -1;
154 static gint ett_cms_OriginatorInfo = -1;
155 static gint ett_cms_RecipientInfos = -1;
156 static gint ett_cms_EncryptedContentInfo = -1;
157 static gint ett_cms_UnprotectedAttributes = -1;
158 static gint ett_cms_RecipientInfo = -1;
159 static gint ett_cms_KeyTransRecipientInfo = -1;
160 static gint ett_cms_RecipientIdentifier = -1;
161 static gint ett_cms_KeyAgreeRecipientInfo = -1;
162 static gint ett_cms_OriginatorIdentifierOrKey = -1;
163 static gint ett_cms_OriginatorPublicKey = -1;
164 static gint ett_cms_RecipientEncryptedKeys = -1;
165 static gint ett_cms_RecipientEncryptedKey = -1;
166 static gint ett_cms_KeyAgreeRecipientIdentifier = -1;
167 static gint ett_cms_RecipientKeyIdentifier = -1;
168 static gint ett_cms_KEKRecipientInfo = -1;
169 static gint ett_cms_KEKIdentifier = -1;
170 static gint ett_cms_DigestedData = -1;
171 static gint ett_cms_EncryptedData = -1;
172 static gint ett_cms_AuthenticatedData = -1;
173 static gint ett_cms_AuthAttributes = -1;
174 static gint ett_cms_UnauthAttributes = -1;
175 static gint ett_cms_CertificateRevocationLists = -1;
176 static gint ett_cms_CertificateChoices = -1;
177 static gint ett_cms_CertificateSet = -1;
178 static gint ett_cms_IssuerAndSerialNumber = -1;
179 static gint ett_cms_OtherKeyAttribute = -1;
180 static gint ett_cms_ExtendedCertificate = -1;
181 static gint ett_cms_ExtendedCertificateInfo = -1;
182
183 /*--- End of included file: packet-cms-ett.c ---*/
184
185
186 static char object_identifier_id[64]; /*64 chars should be long enough? */
187
188
189 /*--- Included file: packet-cms-fn.c ---*/
190
191 /*--- Fields for imported types ---*/
192
193 static int dissect_algorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
194   return dissect_x509af_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_algorithm);
195 }
196 static int dissect_CertificateRevocationLists_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
197   return dissect_x509af_CertificateList(FALSE, tvb, offset, pinfo, tree, hf_cms_CertificateRevocationLists_item);
198 }
199 static int dissect_certificate(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
200   return dissect_x509af_Certificate(FALSE, tvb, offset, pinfo, tree, hf_cms_certificate);
201 }
202 static int dissect_attrCert_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
203   return dissect_x509af_AttributeCertificate(TRUE, tvb, offset, pinfo, tree, hf_cms_attrCert);
204 }
205 static int dissect_issuer(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
206   return dissect_x509if_Name(FALSE, tvb, offset, pinfo, tree, hf_cms_issuer);
207 }
208 static int dissect_serialNumber(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
209   return dissect_x509af_CertificateSerialNumber(FALSE, tvb, offset, pinfo, tree, hf_cms_serialNumber);
210 }
211
212
213 int
214 dissect_cms_ContentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
215   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset,
216                                          hf_index, NULL);
217
218   return offset;
219 }
220 static int dissect_contentType1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
221   return dissect_cms_ContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_contentType1);
222 }
223
224
225 static int
226 dissect_cms_T_contentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
227   offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
228                                          hf_cms_ci_contentType, object_identifier_id);
229
230
231   return offset;
232 }
233 static int dissect_contentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
234   return dissect_cms_T_contentType(FALSE, tvb, offset, pinfo, tree, hf_cms_contentType);
235 }
236
237
238
239 static int
240 dissect_cms_T_content(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
241   offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
242
243
244   return offset;
245 }
246 static int dissect_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
247   return dissect_cms_T_content(FALSE, tvb, offset, pinfo, tree, hf_cms_content);
248 }
249
250 static const ber_sequence ContentInfo_sequence[] = {
251   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_contentType },
252   { BER_CLASS_CON, 0, 0, dissect_content },
253   { 0, 0, 0, NULL }
254 };
255
256 int
257 dissect_cms_ContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
258   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
259                                 ContentInfo_sequence, hf_index, ett_cms_ContentInfo);
260
261   return offset;
262 }
263
264
265 static const value_string CMSVersion_vals[] = {
266   {   0, "v0" },
267   {   1, "v1" },
268   {   2, "v2" },
269   {   3, "v3" },
270   {   4, "v4" },
271   { 0, NULL }
272 };
273
274
275 static int
276 dissect_cms_CMSVersion(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
277   offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
278
279   return offset;
280 }
281 static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
282   return dissect_cms_CMSVersion(FALSE, tvb, offset, pinfo, tree, hf_cms_version);
283 }
284
285
286 static int
287 dissect_cms_DigestAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
288   offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
289
290   return offset;
291 }
292 static int dissect_DigestAlgorithmIdentifiers_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
293   return dissect_cms_DigestAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_DigestAlgorithmIdentifiers_item);
294 }
295 static int dissect_digestAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
296   return dissect_cms_DigestAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_digestAlgorithm);
297 }
298 static int dissect_digestAlgorithm_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
299   return dissect_cms_DigestAlgorithmIdentifier(TRUE, tvb, offset, pinfo, tree, hf_cms_digestAlgorithm);
300 }
301
302 static const ber_sequence DigestAlgorithmIdentifiers_set_of[1] = {
303   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_DigestAlgorithmIdentifiers_item },
304 };
305
306 int
307 dissect_cms_DigestAlgorithmIdentifiers(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
308   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
309                               DigestAlgorithmIdentifiers_set_of, hf_index, ett_cms_DigestAlgorithmIdentifiers);
310
311   return offset;
312 }
313 static int dissect_digestAlgorithms(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
314   return dissect_cms_DigestAlgorithmIdentifiers(FALSE, tvb, offset, pinfo, tree, hf_cms_digestAlgorithms);
315 }
316
317
318 static int
319 dissect_cms_T_eContentType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
320   offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
321                                          hf_cms_ci_contentType, object_identifier_id);
322
323
324   return offset;
325 }
326 static int dissect_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
327   return dissect_cms_T_eContentType(FALSE, tvb, offset, pinfo, tree, hf_cms_eContentType);
328 }
329
330
331 static int
332 dissect_cms_T_eContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
333   guint8 class;
334   gboolean pc, ind;
335   guint32 tag, len;
336   int pdu_offset = offset;
337
338   /* XXX Do we care about printing out the octet string? */
339   offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
340
341   pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag);
342   pdu_offset = get_ber_length(tvb, pdu_offset, &len, &ind);
343   pdu_offset = call_ber_oid_callback(object_identifier_id, tvb, pdu_offset, pinfo, tree);
344
345
346   return offset;
347 }
348 static int dissect_eContent(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
349   return dissect_cms_T_eContent(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent);
350 }
351
352 static const ber_sequence EncapsulatedContentInfo_sequence[] = {
353   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_eContentType },
354   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_eContent },
355   { 0, 0, 0, NULL }
356 };
357
358 int
359 dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
360   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
361                                 EncapsulatedContentInfo_sequence, hf_index, ett_cms_EncapsulatedContentInfo);
362
363   return offset;
364 }
365 static int dissect_encapContentInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
366   return dissect_cms_EncapsulatedContentInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_encapContentInfo);
367 }
368
369
370 static int
371 dissect_cms_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
372   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset,
373                                          hf_index, NULL);
374
375   return offset;
376 }
377 static int dissect_attrType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
378   return dissect_cms_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_cms_attrType);
379 }
380
381 static const ber_sequence Attribute_sequence[] = {
382   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_attrType },
383   { 0, 0, 0, NULL }
384 };
385
386 static int
387 dissect_cms_Attribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
388   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
389                                 Attribute_sequence, hf_index, ett_cms_Attribute);
390
391   return offset;
392 }
393 static int dissect_SignedAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
394   return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_SignedAttributes_item);
395 }
396 static int dissect_UnsignedAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
397   return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_UnsignedAttributes_item);
398 }
399 static int dissect_UnprotectedAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
400   return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_UnprotectedAttributes_item);
401 }
402 static int dissect_AuthAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
403   return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_AuthAttributes_item);
404 }
405 static int dissect_UnauthAttributes_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
406   return dissect_cms_Attribute(FALSE, tvb, offset, pinfo, tree, hf_cms_UnauthAttributes_item);
407 }
408
409 static const ber_sequence UnauthAttributes_set_of[1] = {
410   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_UnauthAttributes_item },
411 };
412
413 static int
414 dissect_cms_UnauthAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
415   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
416                               UnauthAttributes_set_of, hf_index, ett_cms_UnauthAttributes);
417
418   return offset;
419 }
420 static int dissect_unauthenticatedAttributes_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
421   return dissect_cms_UnauthAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_unauthenticatedAttributes);
422 }
423 static int dissect_attributes(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
424   return dissect_cms_UnauthAttributes(FALSE, tvb, offset, pinfo, tree, hf_cms_attributes);
425 }
426
427 static const ber_sequence ExtendedCertificateInfo_sequence[] = {
428   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
429   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certificate },
430   { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_attributes },
431   { 0, 0, 0, NULL }
432 };
433
434 static int
435 dissect_cms_ExtendedCertificateInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
436   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
437                                 ExtendedCertificateInfo_sequence, hf_index, ett_cms_ExtendedCertificateInfo);
438
439   return offset;
440 }
441 static int dissect_extendedCertificateInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
442   return dissect_cms_ExtendedCertificateInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_extendedCertificateInfo);
443 }
444
445
446 static int
447 dissect_cms_SignatureAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
448   offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
449
450   return offset;
451 }
452 static int dissect_signatureAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
453   return dissect_cms_SignatureAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_signatureAlgorithm);
454 }
455
456
457 static int
458 dissect_cms_Signature(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
459   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
460                                  NULL, hf_index, -1,
461                                  NULL);
462
463   return offset;
464 }
465 static int dissect_signature(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
466   return dissect_cms_Signature(FALSE, tvb, offset, pinfo, tree, hf_cms_signature);
467 }
468
469 static const ber_sequence ExtendedCertificate_sequence[] = {
470   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_extendedCertificateInfo },
471   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_signatureAlgorithm },
472   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_signature },
473   { 0, 0, 0, NULL }
474 };
475
476 static int
477 dissect_cms_ExtendedCertificate(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
478   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
479                                 ExtendedCertificate_sequence, hf_index, ett_cms_ExtendedCertificate);
480
481   return offset;
482 }
483 static int dissect_extendedCertificate_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
484   return dissect_cms_ExtendedCertificate(TRUE, tvb, offset, pinfo, tree, hf_cms_extendedCertificate);
485 }
486
487
488 static const value_string CertificateChoices_vals[] = {
489   {   0, "certificate" },
490   {   1, "extendedCertificate" },
491   {   2, "attrCert" },
492   { 0, NULL }
493 };
494
495 static const ber_choice CertificateChoices_choice[] = {
496   {   0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_certificate },
497   {   1, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_extendedCertificate_impl },
498   {   2, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_attrCert_impl },
499   { 0, 0, 0, 0, NULL }
500 };
501
502 static int
503 dissect_cms_CertificateChoices(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
504   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
505                               CertificateChoices_choice, hf_index, ett_cms_CertificateChoices);
506
507   return offset;
508 }
509 static int dissect_CertificateSet_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
510   return dissect_cms_CertificateChoices(FALSE, tvb, offset, pinfo, tree, hf_cms_CertificateSet_item);
511 }
512
513 static const ber_sequence CertificateSet_set_of[1] = {
514   { -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_CertificateSet_item },
515 };
516
517 static int
518 dissect_cms_CertificateSet(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
519   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
520                               CertificateSet_set_of, hf_index, ett_cms_CertificateSet);
521
522   return offset;
523 }
524 static int dissect_certificates_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
525   return dissect_cms_CertificateSet(TRUE, tvb, offset, pinfo, tree, hf_cms_certificates);
526 }
527 static int dissect_certs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
528   return dissect_cms_CertificateSet(TRUE, tvb, offset, pinfo, tree, hf_cms_certs);
529 }
530
531 static const ber_sequence CertificateRevocationLists_set_of[1] = {
532   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_CertificateRevocationLists_item },
533 };
534
535 static int
536 dissect_cms_CertificateRevocationLists(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
537   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
538                               CertificateRevocationLists_set_of, hf_index, ett_cms_CertificateRevocationLists);
539
540   return offset;
541 }
542 static int dissect_crls_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
543   return dissect_cms_CertificateRevocationLists(TRUE, tvb, offset, pinfo, tree, hf_cms_crls);
544 }
545
546 static const ber_sequence IssuerAndSerialNumber_sequence[] = {
547   { BER_CLASS_UNI, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_issuer },
548   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_serialNumber },
549   { 0, 0, 0, NULL }
550 };
551
552 int
553 dissect_cms_IssuerAndSerialNumber(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
554   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
555                                 IssuerAndSerialNumber_sequence, hf_index, ett_cms_IssuerAndSerialNumber);
556
557   return offset;
558 }
559 static int dissect_issuerAndSerialNumber(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
560   return dissect_cms_IssuerAndSerialNumber(FALSE, tvb, offset, pinfo, tree, hf_cms_issuerAndSerialNumber);
561 }
562
563
564 static int
565 dissect_cms_SubjectKeyIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
566   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
567                                     NULL);
568
569   return offset;
570 }
571 static int dissect_subjectKeyIdentifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
572   return dissect_cms_SubjectKeyIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_subjectKeyIdentifier);
573 }
574 static int dissect_subjectKeyIdentifier_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
575   return dissect_cms_SubjectKeyIdentifier(TRUE, tvb, offset, pinfo, tree, hf_cms_subjectKeyIdentifier);
576 }
577
578
579 const value_string SignerIdentifier_vals[] = {
580   {   0, "issuerAndSerialNumber" },
581   {   1, "subjectKeyIdentifier" },
582   { 0, NULL }
583 };
584
585 static const ber_choice SignerIdentifier_choice[] = {
586   {   0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_issuerAndSerialNumber },
587   {   1, BER_CLASS_CON, 0, 0, dissect_subjectKeyIdentifier_impl },
588   { 0, 0, 0, 0, NULL }
589 };
590
591 int
592 dissect_cms_SignerIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
593   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
594                               SignerIdentifier_choice, hf_index, ett_cms_SignerIdentifier);
595
596   return offset;
597 }
598 static int dissect_sid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
599   return dissect_cms_SignerIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_sid);
600 }
601
602 static const ber_sequence SignedAttributes_set_of[1] = {
603   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_SignedAttributes_item },
604 };
605
606 int
607 dissect_cms_SignedAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
608   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
609                               SignedAttributes_set_of, hf_index, ett_cms_SignedAttributes);
610
611   return offset;
612 }
613 static int dissect_signedAttrs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
614   return dissect_cms_SignedAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_signedAttrs);
615 }
616
617
618 int
619 dissect_cms_SignatureValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
620   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
621                                     NULL);
622
623   return offset;
624 }
625 static int dissect_signatureValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
626   return dissect_cms_SignatureValue(FALSE, tvb, offset, pinfo, tree, hf_cms_signatureValue);
627 }
628
629 static const ber_sequence UnsignedAttributes_set_of[1] = {
630   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_UnsignedAttributes_item },
631 };
632
633 int
634 dissect_cms_UnsignedAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
635   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
636                               UnsignedAttributes_set_of, hf_index, ett_cms_UnsignedAttributes);
637
638   return offset;
639 }
640 static int dissect_unsignedAttrs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
641   return dissect_cms_UnsignedAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_unsignedAttrs);
642 }
643
644 static const ber_sequence SignerInfo_sequence[] = {
645   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
646   { -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_sid },
647   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_digestAlgorithm },
648   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_signedAttrs_impl },
649   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_signatureAlgorithm },
650   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_signatureValue },
651   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unsignedAttrs_impl },
652   { 0, 0, 0, NULL }
653 };
654
655 int
656 dissect_cms_SignerInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
657   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
658                                 SignerInfo_sequence, hf_index, ett_cms_SignerInfo);
659
660   return offset;
661 }
662 static int dissect_SignerInfos_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
663   return dissect_cms_SignerInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_SignerInfos_item);
664 }
665
666 static const ber_sequence SignerInfos_set_of[1] = {
667   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_SignerInfos_item },
668 };
669
670 int
671 dissect_cms_SignerInfos(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
672   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
673                               SignerInfos_set_of, hf_index, ett_cms_SignerInfos);
674
675   return offset;
676 }
677 static int dissect_signerInfos(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
678   return dissect_cms_SignerInfos(FALSE, tvb, offset, pinfo, tree, hf_cms_signerInfos);
679 }
680
681 static const ber_sequence SignedData_sequence[] = {
682   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
683   { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_digestAlgorithms },
684   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encapContentInfo },
685   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_certificates_impl },
686   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crls_impl },
687   { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_signerInfos },
688   { 0, 0, 0, NULL }
689 };
690
691 int
692 dissect_cms_SignedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
693   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
694                                 SignedData_sequence, hf_index, ett_cms_SignedData);
695
696   return offset;
697 }
698
699 static const ber_sequence OriginatorInfo_sequence[] = {
700   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_certs_impl },
701   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crls_impl },
702   { 0, 0, 0, NULL }
703 };
704
705 static int
706 dissect_cms_OriginatorInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
707   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
708                                 OriginatorInfo_sequence, hf_index, ett_cms_OriginatorInfo);
709
710   return offset;
711 }
712 static int dissect_originatorInfo_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
713   return dissect_cms_OriginatorInfo(TRUE, tvb, offset, pinfo, tree, hf_cms_originatorInfo);
714 }
715
716
717 static const value_string RecipientIdentifier_vals[] = {
718   {   0, "issuerAndSerialNumber" },
719   {   1, "subjectKeyIdentifier" },
720   { 0, NULL }
721 };
722
723 static const ber_choice RecipientIdentifier_choice[] = {
724   {   0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_issuerAndSerialNumber },
725   {   1, BER_CLASS_CON, 0, 0, dissect_subjectKeyIdentifier_impl },
726   { 0, 0, 0, 0, NULL }
727 };
728
729 static int
730 dissect_cms_RecipientIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
731   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
732                               RecipientIdentifier_choice, hf_index, ett_cms_RecipientIdentifier);
733
734   return offset;
735 }
736 static int dissect_rid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
737   return dissect_cms_RecipientIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_rid);
738 }
739
740
741 static int
742 dissect_cms_KeyEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
743   offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
744
745   return offset;
746 }
747 static int dissect_keyEncryptionAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
748   return dissect_cms_KeyEncryptionAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_keyEncryptionAlgorithm);
749 }
750
751
752 static int
753 dissect_cms_EncryptedKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
754   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
755                                     NULL);
756
757   return offset;
758 }
759 static int dissect_encryptedKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
760   return dissect_cms_EncryptedKey(FALSE, tvb, offset, pinfo, tree, hf_cms_encryptedKey);
761 }
762
763 static const ber_sequence KeyTransRecipientInfo_sequence[] = {
764   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
765   { -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_rid },
766   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyEncryptionAlgorithm },
767   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedKey },
768   { 0, 0, 0, NULL }
769 };
770
771 static int
772 dissect_cms_KeyTransRecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
773   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
774                                 KeyTransRecipientInfo_sequence, hf_index, ett_cms_KeyTransRecipientInfo);
775
776   return offset;
777 }
778 static int dissect_ktri(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
779   return dissect_cms_KeyTransRecipientInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_ktri);
780 }
781
782
783 static int
784 dissect_cms_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
785   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
786                                  NULL, hf_index, -1,
787                                  NULL);
788
789   return offset;
790 }
791 static int dissect_publicKey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
792   return dissect_cms_BIT_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_publicKey);
793 }
794
795 static const ber_sequence OriginatorPublicKey_sequence[] = {
796   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_algorithm },
797   { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_publicKey },
798   { 0, 0, 0, NULL }
799 };
800
801 static int
802 dissect_cms_OriginatorPublicKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
803   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
804                                 OriginatorPublicKey_sequence, hf_index, ett_cms_OriginatorPublicKey);
805
806   return offset;
807 }
808 static int dissect_originatorKey_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
809   return dissect_cms_OriginatorPublicKey(TRUE, tvb, offset, pinfo, tree, hf_cms_originatorKey);
810 }
811
812
813 static const value_string OriginatorIdentifierOrKey_vals[] = {
814   {   0, "issuerAndSerialNumber" },
815   {   1, "subjectKeyIdentifier" },
816   {   2, "originatorKey" },
817   { 0, NULL }
818 };
819
820 static const ber_choice OriginatorIdentifierOrKey_choice[] = {
821   {   0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_issuerAndSerialNumber },
822   {   1, BER_CLASS_CON, 0, 0, dissect_subjectKeyIdentifier_impl },
823   {   2, BER_CLASS_CON, 1, 0, dissect_originatorKey_impl },
824   { 0, 0, 0, 0, NULL }
825 };
826
827 static int
828 dissect_cms_OriginatorIdentifierOrKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
829   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
830                               OriginatorIdentifierOrKey_choice, hf_index, ett_cms_OriginatorIdentifierOrKey);
831
832   return offset;
833 }
834 static int dissect_originator(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
835   return dissect_cms_OriginatorIdentifierOrKey(FALSE, tvb, offset, pinfo, tree, hf_cms_originator);
836 }
837
838
839 static int
840 dissect_cms_UserKeyingMaterial(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
841   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
842                                     NULL);
843
844   return offset;
845 }
846 static int dissect_ukm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
847   return dissect_cms_UserKeyingMaterial(FALSE, tvb, offset, pinfo, tree, hf_cms_ukm);
848 }
849
850
851 static int
852 dissect_cms_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
853   offset = dissect_ber_generalized_time(pinfo, tree, tvb, offset, hf_index);
854
855   return offset;
856 }
857 static int dissect_date(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
858   return dissect_cms_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_cms_date);
859 }
860
861
862 static int
863 dissect_cms_T_keyAttrId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
864   offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
865                                          hf_cms_ci_contentType, object_identifier_id);
866
867
868   return offset;
869 }
870 static int dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
871   return dissect_cms_T_keyAttrId(FALSE, tvb, offset, pinfo, tree, hf_cms_keyAttrId);
872 }
873
874
875
876 static int
877 dissect_cms_T_keyAttr(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
878   offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);
879
880
881   return offset;
882 }
883 static int dissect_keyAttr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
884   return dissect_cms_T_keyAttr(FALSE, tvb, offset, pinfo, tree, hf_cms_keyAttr);
885 }
886
887 static const ber_sequence OtherKeyAttribute_sequence[] = {
888   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId },
889   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_keyAttr },
890   { 0, 0, 0, NULL }
891 };
892
893 static int
894 dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
895   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
896                                 OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute);
897
898   return offset;
899 }
900 static int dissect_other(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
901   return dissect_cms_OtherKeyAttribute(FALSE, tvb, offset, pinfo, tree, hf_cms_other);
902 }
903
904 static const ber_sequence RecipientKeyIdentifier_sequence[] = {
905   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_subjectKeyIdentifier },
906   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_date },
907   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_other },
908   { 0, 0, 0, NULL }
909 };
910
911 static int
912 dissect_cms_RecipientKeyIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
913   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
914                                 RecipientKeyIdentifier_sequence, hf_index, ett_cms_RecipientKeyIdentifier);
915
916   return offset;
917 }
918 static int dissect_rKeyId_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
919   return dissect_cms_RecipientKeyIdentifier(TRUE, tvb, offset, pinfo, tree, hf_cms_rKeyId);
920 }
921
922
923 static const value_string KeyAgreeRecipientIdentifier_vals[] = {
924   {   0, "issuerAndSerialNumber" },
925   {   1, "rKeyId" },
926   { 0, NULL }
927 };
928
929 static const ber_choice KeyAgreeRecipientIdentifier_choice[] = {
930   {   0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_issuerAndSerialNumber },
931   {   1, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_rKeyId_impl },
932   { 0, 0, 0, 0, NULL }
933 };
934
935 static int
936 dissect_cms_KeyAgreeRecipientIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
937   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
938                               KeyAgreeRecipientIdentifier_choice, hf_index, ett_cms_KeyAgreeRecipientIdentifier);
939
940   return offset;
941 }
942 static int dissect_rekRid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
943   return dissect_cms_KeyAgreeRecipientIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_rekRid);
944 }
945
946 static const ber_sequence RecipientEncryptedKey_sequence[] = {
947   { -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_rekRid },
948   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedKey },
949   { 0, 0, 0, NULL }
950 };
951
952 static int
953 dissect_cms_RecipientEncryptedKey(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
954   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
955                                 RecipientEncryptedKey_sequence, hf_index, ett_cms_RecipientEncryptedKey);
956
957   return offset;
958 }
959 static int dissect_RecipientEncryptedKeys_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
960   return dissect_cms_RecipientEncryptedKey(FALSE, tvb, offset, pinfo, tree, hf_cms_RecipientEncryptedKeys_item);
961 }
962
963 static const ber_sequence RecipientEncryptedKeys_sequence_of[1] = {
964   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_RecipientEncryptedKeys_item },
965 };
966
967 static int
968 dissect_cms_RecipientEncryptedKeys(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
969   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
970                                    RecipientEncryptedKeys_sequence_of, hf_index, ett_cms_RecipientEncryptedKeys);
971
972   return offset;
973 }
974 static int dissect_recipientEncryptedKeys(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
975   return dissect_cms_RecipientEncryptedKeys(FALSE, tvb, offset, pinfo, tree, hf_cms_recipientEncryptedKeys);
976 }
977
978 static const ber_sequence KeyAgreeRecipientInfo_sequence[] = {
979   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
980   { BER_CLASS_CON, 0, BER_FLAGS_NOTCHKTAG, dissect_originator },
981   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL, dissect_ukm },
982   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyEncryptionAlgorithm },
983   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_recipientEncryptedKeys },
984   { 0, 0, 0, NULL }
985 };
986
987 static int
988 dissect_cms_KeyAgreeRecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
989   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
990                                 KeyAgreeRecipientInfo_sequence, hf_index, ett_cms_KeyAgreeRecipientInfo);
991
992   return offset;
993 }
994 static int dissect_kari_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
995   return dissect_cms_KeyAgreeRecipientInfo(TRUE, tvb, offset, pinfo, tree, hf_cms_kari);
996 }
997
998
999 static int
1000 dissect_cms_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1001   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1002                                     NULL);
1003
1004   return offset;
1005 }
1006 static int dissect_keyIdentifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1007   return dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_keyIdentifier);
1008 }
1009
1010 static const ber_sequence KEKIdentifier_sequence[] = {
1011   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_keyIdentifier },
1012   { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_date },
1013   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_other },
1014   { 0, 0, 0, NULL }
1015 };
1016
1017 static int
1018 dissect_cms_KEKIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1019   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1020                                 KEKIdentifier_sequence, hf_index, ett_cms_KEKIdentifier);
1021
1022   return offset;
1023 }
1024 static int dissect_kekid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1025   return dissect_cms_KEKIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_kekid);
1026 }
1027
1028 static const ber_sequence KEKRecipientInfo_sequence[] = {
1029   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
1030   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_kekid },
1031   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_keyEncryptionAlgorithm },
1032   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedKey },
1033   { 0, 0, 0, NULL }
1034 };
1035
1036 static int
1037 dissect_cms_KEKRecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1038   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1039                                 KEKRecipientInfo_sequence, hf_index, ett_cms_KEKRecipientInfo);
1040
1041   return offset;
1042 }
1043 static int dissect_kekri_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1044   return dissect_cms_KEKRecipientInfo(TRUE, tvb, offset, pinfo, tree, hf_cms_kekri);
1045 }
1046
1047
1048 static const value_string RecipientInfo_vals[] = {
1049   {   0, "ktri" },
1050   {   1, "kari" },
1051   {   2, "kekri" },
1052   { 0, NULL }
1053 };
1054
1055 static const ber_choice RecipientInfo_choice[] = {
1056   {   0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ktri },
1057   {   1, BER_CLASS_CON, 1, 0, dissect_kari_impl },
1058   {   2, BER_CLASS_CON, 2, 0, dissect_kekri_impl },
1059   { 0, 0, 0, 0, NULL }
1060 };
1061
1062 static int
1063 dissect_cms_RecipientInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1064   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1065                               RecipientInfo_choice, hf_index, ett_cms_RecipientInfo);
1066
1067   return offset;
1068 }
1069 static int dissect_RecipientInfos_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1070   return dissect_cms_RecipientInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_RecipientInfos_item);
1071 }
1072
1073 static const ber_sequence RecipientInfos_set_of[1] = {
1074   { -1/*choice*/ , -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_RecipientInfos_item },
1075 };
1076
1077 static int
1078 dissect_cms_RecipientInfos(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1079   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
1080                               RecipientInfos_set_of, hf_index, ett_cms_RecipientInfos);
1081
1082   return offset;
1083 }
1084 static int dissect_recipientInfos(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1085   return dissect_cms_RecipientInfos(FALSE, tvb, offset, pinfo, tree, hf_cms_recipientInfos);
1086 }
1087
1088
1089 static int
1090 dissect_cms_ContentEncryptionAlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1091   offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1092
1093   return offset;
1094 }
1095 static int dissect_contentEncryptionAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1096   return dissect_cms_ContentEncryptionAlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_cms_contentEncryptionAlgorithm);
1097 }
1098
1099
1100 static int
1101 dissect_cms_EncryptedContent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1102   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1103                                     NULL);
1104
1105   return offset;
1106 }
1107 static int dissect_encryptedContent_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1108   return dissect_cms_EncryptedContent(TRUE, tvb, offset, pinfo, tree, hf_cms_encryptedContent);
1109 }
1110
1111 static const ber_sequence EncryptedContentInfo_sequence[] = {
1112   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_contentType1 },
1113   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_contentEncryptionAlgorithm },
1114   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_encryptedContent_impl },
1115   { 0, 0, 0, NULL }
1116 };
1117
1118 static int
1119 dissect_cms_EncryptedContentInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1120   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1121                                 EncryptedContentInfo_sequence, hf_index, ett_cms_EncryptedContentInfo);
1122
1123   return offset;
1124 }
1125 static int dissect_encryptedContentInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1126   return dissect_cms_EncryptedContentInfo(FALSE, tvb, offset, pinfo, tree, hf_cms_encryptedContentInfo);
1127 }
1128
1129 static const ber_sequence UnprotectedAttributes_set_of[1] = {
1130   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_UnprotectedAttributes_item },
1131 };
1132
1133 static int
1134 dissect_cms_UnprotectedAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1135   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
1136                               UnprotectedAttributes_set_of, hf_index, ett_cms_UnprotectedAttributes);
1137
1138   return offset;
1139 }
1140 static int dissect_unprotectedAttrs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1141   return dissect_cms_UnprotectedAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_unprotectedAttrs);
1142 }
1143
1144 static const ber_sequence EnvelopedData_sequence[] = {
1145   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
1146   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_originatorInfo_impl },
1147   { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_recipientInfos },
1148   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encryptedContentInfo },
1149   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unprotectedAttrs_impl },
1150   { 0, 0, 0, NULL }
1151 };
1152
1153 static int
1154 dissect_cms_EnvelopedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1155   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1156                                 EnvelopedData_sequence, hf_index, ett_cms_EnvelopedData);
1157
1158   return offset;
1159 }
1160
1161
1162 static int
1163 dissect_cms_Digest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1164   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1165                                     NULL);
1166
1167   return offset;
1168 }
1169 static int dissect_digest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1170   return dissect_cms_Digest(FALSE, tvb, offset, pinfo, tree, hf_cms_digest);
1171 }
1172
1173 static const ber_sequence DigestedData_sequence[] = {
1174   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
1175   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_digestAlgorithm },
1176   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encapContentInfo },
1177   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_digest },
1178   { 0, 0, 0, NULL }
1179 };
1180
1181 static int
1182 dissect_cms_DigestedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1183   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1184                                 DigestedData_sequence, hf_index, ett_cms_DigestedData);
1185
1186   return offset;
1187 }
1188
1189 static const ber_sequence EncryptedData_sequence[] = {
1190   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
1191   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encryptedContentInfo },
1192   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unprotectedAttrs_impl },
1193   { 0, 0, 0, NULL }
1194 };
1195
1196 static int
1197 dissect_cms_EncryptedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1198   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1199                                 EncryptedData_sequence, hf_index, ett_cms_EncryptedData);
1200
1201   return offset;
1202 }
1203
1204
1205 static int
1206 dissect_cms_MessageAuthenticationCodeAlgorithm(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1207   offset = dissect_x509af_AlgorithmIdentifier(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1208
1209   return offset;
1210 }
1211 static int dissect_macAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1212   return dissect_cms_MessageAuthenticationCodeAlgorithm(FALSE, tvb, offset, pinfo, tree, hf_cms_macAlgorithm);
1213 }
1214
1215 static const ber_sequence AuthAttributes_set_of[1] = {
1216   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_AuthAttributes_item },
1217 };
1218
1219 static int
1220 dissect_cms_AuthAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1221   offset = dissect_ber_set_of(implicit_tag, pinfo, tree, tvb, offset,
1222                               AuthAttributes_set_of, hf_index, ett_cms_AuthAttributes);
1223
1224   return offset;
1225 }
1226 static int dissect_authenticatedAttributes_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1227   return dissect_cms_AuthAttributes(TRUE, tvb, offset, pinfo, tree, hf_cms_authenticatedAttributes);
1228 }
1229
1230
1231 static int
1232 dissect_cms_MessageAuthenticationCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1233   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1234                                     NULL);
1235
1236   return offset;
1237 }
1238 static int dissect_mac(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1239   return dissect_cms_MessageAuthenticationCode(FALSE, tvb, offset, pinfo, tree, hf_cms_mac);
1240 }
1241
1242 static const ber_sequence AuthenticatedData_sequence[] = {
1243   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
1244   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_originatorInfo_impl },
1245   { BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_recipientInfos },
1246   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_macAlgorithm },
1247   { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_digestAlgorithm_impl },
1248   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_encapContentInfo },
1249   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_authenticatedAttributes_impl },
1250   { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_mac },
1251   { BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_unauthenticatedAttributes_impl },
1252   { 0, 0, 0, NULL }
1253 };
1254
1255 static int
1256 dissect_cms_AuthenticatedData(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1257   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1258                                 AuthenticatedData_sequence, hf_index, ett_cms_AuthenticatedData);
1259
1260   return offset;
1261 }
1262
1263
1264 static int
1265 dissect_cms_Countersignature(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1266   offset = dissect_cms_SignerInfo(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1267
1268   return offset;
1269 }
1270
1271 /*--- PDUs ---*/
1272
1273 static void dissect_SignedData_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
1274   dissect_cms_SignedData(FALSE, tvb, 0, pinfo, tree, hf_cms_SignedData_PDU);
1275 }
1276 static void dissect_EnvelopedData_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
1277   dissect_cms_EnvelopedData(FALSE, tvb, 0, pinfo, tree, hf_cms_EnvelopedData_PDU);
1278 }
1279 static void dissect_DigestedData_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
1280   dissect_cms_DigestedData(FALSE, tvb, 0, pinfo, tree, hf_cms_DigestedData_PDU);
1281 }
1282 static void dissect_EncryptedData_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
1283   dissect_cms_EncryptedData(FALSE, tvb, 0, pinfo, tree, hf_cms_EncryptedData_PDU);
1284 }
1285 static void dissect_AuthenticatedData_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
1286   dissect_cms_AuthenticatedData(FALSE, tvb, 0, pinfo, tree, hf_cms_AuthenticatedData_PDU);
1287 }
1288
1289
1290 /*--- End of included file: packet-cms-fn.c ---*/
1291
1292
1293
1294 /*--- proto_register_cms ----------------------------------------------*/
1295 void proto_register_cms(void) {
1296
1297   /* List of fields */
1298   static hf_register_info hf[] = {
1299     { &hf_cms_ci_contentType,
1300       { "contentType", "cms.contentInfo.contentType",
1301         FT_STRING, BASE_NONE, NULL, 0,
1302         "ContentType", HFILL }},
1303
1304 /*--- Included file: packet-cms-hfarr.c ---*/
1305
1306     { &hf_cms_SignedData_PDU,
1307       { "SignedData", "cms.SignedData",
1308         FT_NONE, BASE_NONE, NULL, 0,
1309         "SignedData", HFILL }},
1310     { &hf_cms_EnvelopedData_PDU,
1311       { "EnvelopedData", "cms.EnvelopedData",
1312         FT_NONE, BASE_NONE, NULL, 0,
1313         "EnvelopedData", HFILL }},
1314     { &hf_cms_DigestedData_PDU,
1315       { "DigestedData", "cms.DigestedData",
1316         FT_NONE, BASE_NONE, NULL, 0,
1317         "DigestedData", HFILL }},
1318     { &hf_cms_EncryptedData_PDU,
1319       { "EncryptedData", "cms.EncryptedData",
1320         FT_NONE, BASE_NONE, NULL, 0,
1321         "EncryptedData", HFILL }},
1322     { &hf_cms_AuthenticatedData_PDU,
1323       { "AuthenticatedData", "cms.AuthenticatedData",
1324         FT_NONE, BASE_NONE, NULL, 0,
1325         "AuthenticatedData", HFILL }},
1326     { &hf_cms_contentType,
1327       { "contentType", "cms.contentType",
1328         FT_STRING, BASE_NONE, NULL, 0,
1329         "ContentInfo/contentType", HFILL }},
1330     { &hf_cms_content,
1331       { "content", "cms.content",
1332         FT_NONE, BASE_NONE, NULL, 0,
1333         "ContentInfo/content", HFILL }},
1334     { &hf_cms_version,
1335       { "version", "cms.version",
1336         FT_INT32, BASE_DEC, VALS(CMSVersion_vals), 0,
1337         "", HFILL }},
1338     { &hf_cms_digestAlgorithms,
1339       { "digestAlgorithms", "cms.digestAlgorithms",
1340         FT_UINT32, BASE_DEC, NULL, 0,
1341         "SignedData/digestAlgorithms", HFILL }},
1342     { &hf_cms_encapContentInfo,
1343       { "encapContentInfo", "cms.encapContentInfo",
1344         FT_NONE, BASE_NONE, NULL, 0,
1345         "", HFILL }},
1346     { &hf_cms_certificates,
1347       { "certificates", "cms.certificates",
1348         FT_UINT32, BASE_DEC, NULL, 0,
1349         "SignedData/certificates", HFILL }},
1350     { &hf_cms_crls,
1351       { "crls", "cms.crls",
1352         FT_UINT32, BASE_DEC, NULL, 0,
1353         "", HFILL }},
1354     { &hf_cms_signerInfos,
1355       { "signerInfos", "cms.signerInfos",
1356         FT_UINT32, BASE_DEC, NULL, 0,
1357         "SignedData/signerInfos", HFILL }},
1358     { &hf_cms_DigestAlgorithmIdentifiers_item,
1359       { "Item", "cms.DigestAlgorithmIdentifiers_item",
1360         FT_NONE, BASE_NONE, NULL, 0,
1361         "DigestAlgorithmIdentifiers/_item", HFILL }},
1362     { &hf_cms_SignerInfos_item,
1363       { "Item", "cms.SignerInfos_item",
1364         FT_NONE, BASE_NONE, NULL, 0,
1365         "SignerInfos/_item", HFILL }},
1366     { &hf_cms_eContentType,
1367       { "eContentType", "cms.eContentType",
1368         FT_STRING, BASE_NONE, NULL, 0,
1369         "EncapsulatedContentInfo/eContentType", HFILL }},
1370     { &hf_cms_eContent,
1371       { "eContent", "cms.eContent",
1372         FT_BYTES, BASE_HEX, NULL, 0,
1373         "EncapsulatedContentInfo/eContent", HFILL }},
1374     { &hf_cms_sid,
1375       { "sid", "cms.sid",
1376         FT_UINT32, BASE_DEC, VALS(SignerIdentifier_vals), 0,
1377         "SignerInfo/sid", HFILL }},
1378     { &hf_cms_digestAlgorithm,
1379       { "digestAlgorithm", "cms.digestAlgorithm",
1380         FT_NONE, BASE_NONE, NULL, 0,
1381         "", HFILL }},
1382     { &hf_cms_signedAttrs,
1383       { "signedAttrs", "cms.signedAttrs",
1384         FT_UINT32, BASE_DEC, NULL, 0,
1385         "SignerInfo/signedAttrs", HFILL }},
1386     { &hf_cms_signatureAlgorithm,
1387       { "signatureAlgorithm", "cms.signatureAlgorithm",
1388         FT_NONE, BASE_NONE, NULL, 0,
1389         "", HFILL }},
1390     { &hf_cms_signatureValue,
1391       { "signature", "cms.signature",
1392         FT_BYTES, BASE_HEX, NULL, 0,
1393         "SignerInfo/signature", HFILL }},
1394     { &hf_cms_unsignedAttrs,
1395       { "unsignedAttrs", "cms.unsignedAttrs",
1396         FT_UINT32, BASE_DEC, NULL, 0,
1397         "SignerInfo/unsignedAttrs", HFILL }},
1398     { &hf_cms_issuerAndSerialNumber,
1399       { "issuerAndSerialNumber", "cms.issuerAndSerialNumber",
1400         FT_NONE, BASE_NONE, NULL, 0,
1401         "", HFILL }},
1402     { &hf_cms_subjectKeyIdentifier,
1403       { "subjectKeyIdentifier", "cms.subjectKeyIdentifier",
1404         FT_BYTES, BASE_HEX, NULL, 0,
1405         "", HFILL }},
1406     { &hf_cms_SignedAttributes_item,
1407       { "Item", "cms.SignedAttributes_item",
1408         FT_NONE, BASE_NONE, NULL, 0,
1409         "SignedAttributes/_item", HFILL }},
1410     { &hf_cms_UnsignedAttributes_item,
1411       { "Item", "cms.UnsignedAttributes_item",
1412         FT_NONE, BASE_NONE, NULL, 0,
1413         "UnsignedAttributes/_item", HFILL }},
1414     { &hf_cms_attrType,
1415       { "attrType", "cms.attrType",
1416         FT_STRING, BASE_NONE, NULL, 0,
1417         "Attribute/attrType", HFILL }},
1418     { &hf_cms_originatorInfo,
1419       { "originatorInfo", "cms.originatorInfo",
1420         FT_NONE, BASE_NONE, NULL, 0,
1421         "", HFILL }},
1422     { &hf_cms_recipientInfos,
1423       { "recipientInfos", "cms.recipientInfos",
1424         FT_UINT32, BASE_DEC, NULL, 0,
1425         "", HFILL }},
1426     { &hf_cms_encryptedContentInfo,
1427       { "encryptedContentInfo", "cms.encryptedContentInfo",
1428         FT_NONE, BASE_NONE, NULL, 0,
1429         "", HFILL }},
1430     { &hf_cms_unprotectedAttrs,
1431       { "unprotectedAttrs", "cms.unprotectedAttrs",
1432         FT_UINT32, BASE_DEC, NULL, 0,
1433         "", HFILL }},
1434     { &hf_cms_certs,
1435       { "certs", "cms.certs",
1436         FT_UINT32, BASE_DEC, NULL, 0,
1437         "OriginatorInfo/certs", HFILL }},
1438     { &hf_cms_RecipientInfos_item,
1439       { "Item", "cms.RecipientInfos_item",
1440         FT_UINT32, BASE_DEC, VALS(RecipientInfo_vals), 0,
1441         "RecipientInfos/_item", HFILL }},
1442     { &hf_cms_contentType1,
1443       { "contentType", "cms.contentType",
1444         FT_STRING, BASE_NONE, NULL, 0,
1445         "EncryptedContentInfo/contentType", HFILL }},
1446     { &hf_cms_contentEncryptionAlgorithm,
1447       { "contentEncryptionAlgorithm", "cms.contentEncryptionAlgorithm",
1448         FT_NONE, BASE_NONE, NULL, 0,
1449         "EncryptedContentInfo/contentEncryptionAlgorithm", HFILL }},
1450     { &hf_cms_encryptedContent,
1451       { "encryptedContent", "cms.encryptedContent",
1452         FT_BYTES, BASE_HEX, NULL, 0,
1453         "EncryptedContentInfo/encryptedContent", HFILL }},
1454     { &hf_cms_UnprotectedAttributes_item,
1455       { "Item", "cms.UnprotectedAttributes_item",
1456         FT_NONE, BASE_NONE, NULL, 0,
1457         "UnprotectedAttributes/_item", HFILL }},
1458     { &hf_cms_ktri,
1459       { "ktri", "cms.ktri",
1460         FT_NONE, BASE_NONE, NULL, 0,
1461         "RecipientInfo/ktri", HFILL }},
1462     { &hf_cms_kari,
1463       { "kari", "cms.kari",
1464         FT_NONE, BASE_NONE, NULL, 0,
1465         "RecipientInfo/kari", HFILL }},
1466     { &hf_cms_kekri,
1467       { "kekri", "cms.kekri",
1468         FT_NONE, BASE_NONE, NULL, 0,
1469         "RecipientInfo/kekri", HFILL }},
1470     { &hf_cms_rid,
1471       { "rid", "cms.rid",
1472         FT_UINT32, BASE_DEC, VALS(RecipientIdentifier_vals), 0,
1473         "KeyTransRecipientInfo/rid", HFILL }},
1474     { &hf_cms_keyEncryptionAlgorithm,
1475       { "keyEncryptionAlgorithm", "cms.keyEncryptionAlgorithm",
1476         FT_NONE, BASE_NONE, NULL, 0,
1477         "", HFILL }},
1478     { &hf_cms_encryptedKey,
1479       { "encryptedKey", "cms.encryptedKey",
1480         FT_BYTES, BASE_HEX, NULL, 0,
1481         "", HFILL }},
1482     { &hf_cms_originator,
1483       { "originator", "cms.originator",
1484         FT_UINT32, BASE_DEC, VALS(OriginatorIdentifierOrKey_vals), 0,
1485         "KeyAgreeRecipientInfo/originator", HFILL }},
1486     { &hf_cms_ukm,
1487       { "ukm", "cms.ukm",
1488         FT_BYTES, BASE_HEX, NULL, 0,
1489         "KeyAgreeRecipientInfo/ukm", HFILL }},
1490     { &hf_cms_recipientEncryptedKeys,
1491       { "recipientEncryptedKeys", "cms.recipientEncryptedKeys",
1492         FT_UINT32, BASE_DEC, NULL, 0,
1493         "KeyAgreeRecipientInfo/recipientEncryptedKeys", HFILL }},
1494     { &hf_cms_originatorKey,
1495       { "originatorKey", "cms.originatorKey",
1496         FT_NONE, BASE_NONE, NULL, 0,
1497         "OriginatorIdentifierOrKey/originatorKey", HFILL }},
1498     { &hf_cms_algorithm,
1499       { "algorithm", "cms.algorithm",
1500         FT_NONE, BASE_NONE, NULL, 0,
1501         "OriginatorPublicKey/algorithm", HFILL }},
1502     { &hf_cms_publicKey,
1503       { "publicKey", "cms.publicKey",
1504         FT_BYTES, BASE_HEX, NULL, 0,
1505         "OriginatorPublicKey/publicKey", HFILL }},
1506     { &hf_cms_RecipientEncryptedKeys_item,
1507       { "Item", "cms.RecipientEncryptedKeys_item",
1508         FT_NONE, BASE_NONE, NULL, 0,
1509         "RecipientEncryptedKeys/_item", HFILL }},
1510     { &hf_cms_rekRid,
1511       { "rid", "cms.rid",
1512         FT_UINT32, BASE_DEC, VALS(KeyAgreeRecipientIdentifier_vals), 0,
1513         "RecipientEncryptedKey/rid", HFILL }},
1514     { &hf_cms_rKeyId,
1515       { "rKeyId", "cms.rKeyId",
1516         FT_NONE, BASE_NONE, NULL, 0,
1517         "KeyAgreeRecipientIdentifier/rKeyId", HFILL }},
1518     { &hf_cms_date,
1519       { "date", "cms.date",
1520         FT_STRING, BASE_NONE, NULL, 0,
1521         "", HFILL }},
1522     { &hf_cms_other,
1523       { "other", "cms.other",
1524         FT_NONE, BASE_NONE, NULL, 0,
1525         "", HFILL }},
1526     { &hf_cms_kekid,
1527       { "kekid", "cms.kekid",
1528         FT_NONE, BASE_NONE, NULL, 0,
1529         "KEKRecipientInfo/kekid", HFILL }},
1530     { &hf_cms_keyIdentifier,
1531       { "keyIdentifier", "cms.keyIdentifier",
1532         FT_BYTES, BASE_HEX, NULL, 0,
1533         "KEKIdentifier/keyIdentifier", HFILL }},
1534     { &hf_cms_digest,
1535       { "digest", "cms.digest",
1536         FT_BYTES, BASE_HEX, NULL, 0,
1537         "DigestedData/digest", HFILL }},
1538     { &hf_cms_macAlgorithm,
1539       { "macAlgorithm", "cms.macAlgorithm",
1540         FT_NONE, BASE_NONE, NULL, 0,
1541         "AuthenticatedData/macAlgorithm", HFILL }},
1542     { &hf_cms_authenticatedAttributes,
1543       { "authenticatedAttributes", "cms.authenticatedAttributes",
1544         FT_UINT32, BASE_DEC, NULL, 0,
1545         "AuthenticatedData/authenticatedAttributes", HFILL }},
1546     { &hf_cms_mac,
1547       { "mac", "cms.mac",
1548         FT_BYTES, BASE_HEX, NULL, 0,
1549         "AuthenticatedData/mac", HFILL }},
1550     { &hf_cms_unauthenticatedAttributes,
1551       { "unauthenticatedAttributes", "cms.unauthenticatedAttributes",
1552         FT_UINT32, BASE_DEC, NULL, 0,
1553         "AuthenticatedData/unauthenticatedAttributes", HFILL }},
1554     { &hf_cms_AuthAttributes_item,
1555       { "Item", "cms.AuthAttributes_item",
1556         FT_NONE, BASE_NONE, NULL, 0,
1557         "AuthAttributes/_item", HFILL }},
1558     { &hf_cms_UnauthAttributes_item,
1559       { "Item", "cms.UnauthAttributes_item",
1560         FT_NONE, BASE_NONE, NULL, 0,
1561         "UnauthAttributes/_item", HFILL }},
1562     { &hf_cms_CertificateRevocationLists_item,
1563       { "Item", "cms.CertificateRevocationLists_item",
1564         FT_NONE, BASE_NONE, NULL, 0,
1565         "CertificateRevocationLists/_item", HFILL }},
1566     { &hf_cms_certificate,
1567       { "certificate", "cms.certificate",
1568         FT_NONE, BASE_NONE, NULL, 0,
1569         "", HFILL }},
1570     { &hf_cms_extendedCertificate,
1571       { "extendedCertificate", "cms.extendedCertificate",
1572         FT_NONE, BASE_NONE, NULL, 0,
1573         "CertificateChoices/extendedCertificate", HFILL }},
1574     { &hf_cms_attrCert,
1575       { "attrCert", "cms.attrCert",
1576         FT_NONE, BASE_NONE, NULL, 0,
1577         "CertificateChoices/attrCert", HFILL }},
1578     { &hf_cms_CertificateSet_item,
1579       { "Item", "cms.CertificateSet_item",
1580         FT_UINT32, BASE_DEC, VALS(CertificateChoices_vals), 0,
1581         "CertificateSet/_item", HFILL }},
1582     { &hf_cms_issuer,
1583       { "issuer", "cms.issuer",
1584         FT_UINT32, BASE_DEC, VALS(Name_vals), 0,
1585         "IssuerAndSerialNumber/issuer", HFILL }},
1586     { &hf_cms_serialNumber,
1587       { "serialNumber", "cms.serialNumber",
1588         FT_INT32, BASE_DEC, NULL, 0,
1589         "IssuerAndSerialNumber/serialNumber", HFILL }},
1590     { &hf_cms_keyAttrId,
1591       { "keyAttrId", "cms.keyAttrId",
1592         FT_STRING, BASE_NONE, NULL, 0,
1593         "OtherKeyAttribute/keyAttrId", HFILL }},
1594     { &hf_cms_keyAttr,
1595       { "keyAttr", "cms.keyAttr",
1596         FT_NONE, BASE_NONE, NULL, 0,
1597         "OtherKeyAttribute/keyAttr", HFILL }},
1598     { &hf_cms_extendedCertificateInfo,
1599       { "extendedCertificateInfo", "cms.extendedCertificateInfo",
1600         FT_NONE, BASE_NONE, NULL, 0,
1601         "ExtendedCertificate/extendedCertificateInfo", HFILL }},
1602     { &hf_cms_signature,
1603       { "signature", "cms.signature",
1604         FT_BYTES, BASE_HEX, NULL, 0,
1605         "ExtendedCertificate/signature", HFILL }},
1606     { &hf_cms_attributes,
1607       { "attributes", "cms.attributes",
1608         FT_UINT32, BASE_DEC, NULL, 0,
1609         "ExtendedCertificateInfo/attributes", HFILL }},
1610
1611 /*--- End of included file: packet-cms-hfarr.c ---*/
1612
1613   };
1614
1615   /* List of subtrees */
1616   static gint *ett[] = {
1617
1618 /*--- Included file: packet-cms-ettarr.c ---*/
1619
1620     &ett_cms_ContentInfo,
1621     &ett_cms_SignedData,
1622     &ett_cms_DigestAlgorithmIdentifiers,
1623     &ett_cms_SignerInfos,
1624     &ett_cms_EncapsulatedContentInfo,
1625     &ett_cms_SignerInfo,
1626     &ett_cms_SignerIdentifier,
1627     &ett_cms_SignedAttributes,
1628     &ett_cms_UnsignedAttributes,
1629     &ett_cms_Attribute,
1630     &ett_cms_EnvelopedData,
1631     &ett_cms_OriginatorInfo,
1632     &ett_cms_RecipientInfos,
1633     &ett_cms_EncryptedContentInfo,
1634     &ett_cms_UnprotectedAttributes,
1635     &ett_cms_RecipientInfo,
1636     &ett_cms_KeyTransRecipientInfo,
1637     &ett_cms_RecipientIdentifier,
1638     &ett_cms_KeyAgreeRecipientInfo,
1639     &ett_cms_OriginatorIdentifierOrKey,
1640     &ett_cms_OriginatorPublicKey,
1641     &ett_cms_RecipientEncryptedKeys,
1642     &ett_cms_RecipientEncryptedKey,
1643     &ett_cms_KeyAgreeRecipientIdentifier,
1644     &ett_cms_RecipientKeyIdentifier,
1645     &ett_cms_KEKRecipientInfo,
1646     &ett_cms_KEKIdentifier,
1647     &ett_cms_DigestedData,
1648     &ett_cms_EncryptedData,
1649     &ett_cms_AuthenticatedData,
1650     &ett_cms_AuthAttributes,
1651     &ett_cms_UnauthAttributes,
1652     &ett_cms_CertificateRevocationLists,
1653     &ett_cms_CertificateChoices,
1654     &ett_cms_CertificateSet,
1655     &ett_cms_IssuerAndSerialNumber,
1656     &ett_cms_OtherKeyAttribute,
1657     &ett_cms_ExtendedCertificate,
1658     &ett_cms_ExtendedCertificateInfo,
1659
1660 /*--- End of included file: packet-cms-ettarr.c ---*/
1661
1662   };
1663
1664   /* Register protocol */
1665   proto_cms = proto_register_protocol(PNAME, PSNAME, PFNAME);
1666
1667   /* Register fields and subtrees */
1668   proto_register_field_array(proto_cms, hf, array_length(hf));
1669   proto_register_subtree_array(ett, array_length(ett));
1670
1671 }
1672
1673
1674 /*--- proto_reg_handoff_cms -------------------------------------------*/
1675 void proto_reg_handoff_cms(void) {
1676
1677 /*--- Included file: packet-cms-dis-tab.c ---*/
1678
1679  register_ber_oid_dissector("1.2.840.113549.1.7.2", dissect_SignedData_PDU, proto_cms, "id-signedData");
1680  register_ber_oid_dissector("1.2.840.113549.1.7.3", dissect_EnvelopedData_PDU, proto_cms, "id-envelopedData");
1681  register_ber_oid_dissector("1.2.840.113549.1.7.5", dissect_DigestedData_PDU, proto_cms, "id-digestedData");
1682  register_ber_oid_dissector("1.2.840.113549.1.7.6", dissect_EncryptedData_PDU, proto_cms, "id-encryptedData");
1683  register_ber_oid_dissector("1.2.840.113549.1.9.16.1.2", dissect_AuthenticatedData_PDU, proto_cms, "id-ct-authenticatedData");
1684
1685
1686 /*--- End of included file: packet-cms-dis-tab.c ---*/
1687
1688 }
1689