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