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