Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-crmf.c
blob73bdd9393be9500dfcaa456ddafae953841ba96a
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-crmf.c */
4 /* asn2wrs.py -b -q -L -p crmf -c ./crmf.cnf -s ./packet-crmf-template -D . -O ../.. CRMF.asn */
6 /* packet-crmf.c
7 * Routines for RFC2511 Certificate Request Message Format packet dissection
8 * Ronnie Sahlberg 2004
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include "config.h"
19 #include <epan/packet.h>
20 #include <epan/oids.h>
21 #include <epan/asn1.h>
22 #include <wsutil/array.h>
24 #include "packet-ber.h"
25 #include "packet-crmf.h"
26 #include "packet-cms.h"
27 #include "packet-pkix1explicit.h"
28 #include "packet-pkix1implicit.h"
30 #define PNAME "Certificate Request Message Format"
31 #define PSNAME "CRMF"
32 #define PFNAME "crmf"
34 void proto_register_crmf(void);
35 void proto_reg_handoff_crmf(void);
37 /* Initialize the protocol and registered fields */
38 static int proto_crmf;
39 static int hf_crmf_type_oid;
40 static int hf_crmf_PBMParameter_PDU; /* PBMParameter */
41 static int hf_crmf_RegToken_PDU; /* RegToken */
42 static int hf_crmf_Authenticator_PDU; /* Authenticator */
43 static int hf_crmf_PKIPublicationInfo_PDU; /* PKIPublicationInfo */
44 static int hf_crmf_PKIArchiveOptions_PDU; /* PKIArchiveOptions */
45 static int hf_crmf_OldCertId_PDU; /* OldCertId */
46 static int hf_crmf_ProtocolEncrKey_PDU; /* ProtocolEncrKey */
47 static int hf_crmf_UTF8Pairs_PDU; /* UTF8Pairs */
48 static int hf_crmf_CertReq_PDU; /* CertReq */
49 static int hf_crmf_EncKeyWithID_PDU; /* EncKeyWithID */
50 static int hf_crmf_CertReqMessages_item; /* CertReqMsg */
51 static int hf_crmf_certReq; /* CertRequest */
52 static int hf_crmf_popo; /* ProofOfPossession */
53 static int hf_crmf_regInfo; /* SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue */
54 static int hf_crmf_regInfo_item; /* AttributeTypeAndValue */
55 static int hf_crmf_certReqId; /* INTEGER */
56 static int hf_crmf_certTemplate; /* CertTemplate */
57 static int hf_crmf_controls; /* Controls */
58 static int hf_crmf_version; /* Version */
59 static int hf_crmf_serialNumber; /* INTEGER_MIN_MAX */
60 static int hf_crmf_signingAlg; /* AlgorithmIdentifier */
61 static int hf_crmf_template_issuer; /* Name */
62 static int hf_crmf_validity; /* OptionalValidity */
63 static int hf_crmf_subject; /* Name */
64 static int hf_crmf_publicKey; /* SubjectPublicKeyInfo */
65 static int hf_crmf_issuerUID; /* UniqueIdentifier */
66 static int hf_crmf_subjectUID; /* UniqueIdentifier */
67 static int hf_crmf_extensions; /* Extensions */
68 static int hf_crmf_notBefore; /* Time */
69 static int hf_crmf_notAfter; /* Time */
70 static int hf_crmf_Controls_item; /* AttributeTypeAndValue */
71 static int hf_crmf_type; /* T_type */
72 static int hf_crmf_value; /* T_value */
73 static int hf_crmf_raVerified; /* NULL */
74 static int hf_crmf_signature; /* POPOSigningKey */
75 static int hf_crmf_keyEncipherment; /* POPOPrivKey */
76 static int hf_crmf_keyAgreement; /* POPOPrivKey */
77 static int hf_crmf_poposkInput; /* POPOSigningKeyInput */
78 static int hf_crmf_algorithmIdentifier; /* AlgorithmIdentifier */
79 static int hf_crmf_sk_signature; /* BIT_STRING */
80 static int hf_crmf_authInfo; /* T_authInfo */
81 static int hf_crmf_sender; /* GeneralName */
82 static int hf_crmf_publicKeyMAC; /* PKMACValue */
83 static int hf_crmf_algId; /* AlgorithmIdentifier */
84 static int hf_crmf_pkmac_value; /* BIT_STRING */
85 static int hf_crmf_salt; /* OCTET_STRING */
86 static int hf_crmf_owf; /* AlgorithmIdentifier */
87 static int hf_crmf_iterationCount; /* INTEGER */
88 static int hf_crmf_mac; /* AlgorithmIdentifier */
89 static int hf_crmf_thisMessage; /* BIT_STRING */
90 static int hf_crmf_subsequentMessage; /* SubsequentMessage */
91 static int hf_crmf_dhMAC; /* BIT_STRING */
92 static int hf_crmf_agreeMAC; /* PKMACValue */
93 static int hf_crmf_encryptedKey; /* EnvelopedData */
94 static int hf_crmf_action; /* T_action */
95 static int hf_crmf_pubInfos; /* SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo */
96 static int hf_crmf_pubInfos_item; /* SinglePubInfo */
97 static int hf_crmf_pubMethod; /* T_pubMethod */
98 static int hf_crmf_pubLocation; /* GeneralName */
99 static int hf_crmf_encryptedPrivKey; /* EncryptedKey */
100 static int hf_crmf_keyGenParameters; /* KeyGenParameters */
101 static int hf_crmf_archiveRemGenPrivKey; /* BOOLEAN */
102 static int hf_crmf_encryptedValue; /* EncryptedValue */
103 static int hf_crmf_envelopedData; /* EnvelopedData */
104 static int hf_crmf_intendedAlg; /* AlgorithmIdentifier */
105 static int hf_crmf_symmAlg; /* AlgorithmIdentifier */
106 static int hf_crmf_encSymmKey; /* BIT_STRING */
107 static int hf_crmf_keyAlg; /* AlgorithmIdentifier */
108 static int hf_crmf_valueHint; /* OCTET_STRING */
109 static int hf_crmf_encValue; /* BIT_STRING */
110 static int hf_crmf_issuer; /* GeneralName */
111 static int hf_crmf_enckeywid_privkey; /* PrivateKeyInfo */
112 static int hf_crmf_identifier; /* T_identifier */
113 static int hf_crmf_string; /* UTF8String */
114 static int hf_crmf_generalName; /* GeneralName */
115 static int hf_crmf_privkey_version; /* INTEGER */
116 static int hf_crmf_privateKeyAlgorithm; /* AlgorithmIdentifier */
117 static int hf_crmf_privateKey; /* OCTET_STRING */
118 static int hf_crmf_attributes; /* Attributes */
119 static int hf_crmf_Attributes_item; /* Attribute */
121 /* Initialize the subtree pointers */
122 static int ett_crmf_CertReqMessages;
123 static int ett_crmf_CertReqMsg;
124 static int ett_crmf_SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue;
125 static int ett_crmf_CertRequest;
126 static int ett_crmf_CertTemplate;
127 static int ett_crmf_OptionalValidity;
128 static int ett_crmf_Controls;
129 static int ett_crmf_AttributeTypeAndValue;
130 static int ett_crmf_ProofOfPossession;
131 static int ett_crmf_POPOSigningKey;
132 static int ett_crmf_POPOSigningKeyInput;
133 static int ett_crmf_T_authInfo;
134 static int ett_crmf_PKMACValue;
135 static int ett_crmf_PBMParameter;
136 static int ett_crmf_POPOPrivKey;
137 static int ett_crmf_PKIPublicationInfo;
138 static int ett_crmf_SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo;
139 static int ett_crmf_SinglePubInfo;
140 static int ett_crmf_PKIArchiveOptions;
141 static int ett_crmf_EncryptedKey;
142 static int ett_crmf_EncryptedValue;
143 static int ett_crmf_CertId;
144 static int ett_crmf_EncKeyWithID;
145 static int ett_crmf_T_identifier;
146 static int ett_crmf_PrivateKeyInfo;
147 static int ett_crmf_Attributes;
150 static int
151 dissect_crmf_INTEGER(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
152 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
153 NULL);
155 return offset;
160 static int
161 dissect_crmf_INTEGER_MIN_MAX(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
162 offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
163 NULL);
165 return offset;
169 static const ber_sequence_t OptionalValidity_sequence[] = {
170 { &hf_crmf_notBefore , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Time },
171 { &hf_crmf_notAfter , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Time },
172 { NULL, 0, 0, 0, NULL }
175 static int
176 dissect_crmf_OptionalValidity(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
177 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
178 OptionalValidity_sequence, hf_index, ett_crmf_OptionalValidity);
180 return offset;
184 static const ber_sequence_t CertTemplate_sequence[] = {
185 { &hf_crmf_version , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Version },
186 { &hf_crmf_serialNumber , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crmf_INTEGER_MIN_MAX },
187 { &hf_crmf_signingAlg , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_AlgorithmIdentifier },
188 { &hf_crmf_template_issuer, BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Name },
189 { &hf_crmf_validity , BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crmf_OptionalValidity },
190 { &hf_crmf_subject , BER_CLASS_CON, 5, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Name },
191 { &hf_crmf_publicKey , BER_CLASS_CON, 6, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_SubjectPublicKeyInfo },
192 { &hf_crmf_issuerUID , BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_UniqueIdentifier },
193 { &hf_crmf_subjectUID , BER_CLASS_CON, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_UniqueIdentifier },
194 { &hf_crmf_extensions , BER_CLASS_CON, 9, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_Extensions },
195 { NULL, 0, 0, 0, NULL }
199 dissect_crmf_CertTemplate(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
200 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
201 CertTemplate_sequence, hf_index, ett_crmf_CertTemplate);
203 return offset;
208 static int
209 dissect_crmf_T_type(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
210 offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_crmf_type_oid, &actx->external.direct_reference);
212 return offset;
217 static int
218 dissect_crmf_T_value(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
219 offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
222 return offset;
226 static const ber_sequence_t AttributeTypeAndValue_sequence[] = {
227 { &hf_crmf_type , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_crmf_T_type },
228 { &hf_crmf_value , BER_CLASS_ANY, 0, BER_FLAGS_NOOWNTAG, dissect_crmf_T_value },
229 { NULL, 0, 0, 0, NULL }
233 dissect_crmf_AttributeTypeAndValue(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
234 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
235 AttributeTypeAndValue_sequence, hf_index, ett_crmf_AttributeTypeAndValue);
237 return offset;
241 static const ber_sequence_t Controls_sequence_of[1] = {
242 { &hf_crmf_Controls_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_AttributeTypeAndValue },
245 static int
246 dissect_crmf_Controls(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
247 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
248 Controls_sequence_of, hf_index, ett_crmf_Controls);
250 return offset;
254 static const ber_sequence_t CertRequest_sequence[] = {
255 { &hf_crmf_certReqId , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_crmf_INTEGER },
256 { &hf_crmf_certTemplate , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_CertTemplate },
257 { &hf_crmf_controls , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_crmf_Controls },
258 { NULL, 0, 0, 0, NULL }
261 static int
262 dissect_crmf_CertRequest(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
263 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
264 CertRequest_sequence, hf_index, ett_crmf_CertRequest);
266 return offset;
271 static int
272 dissect_crmf_NULL(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
273 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
275 return offset;
280 static int
281 dissect_crmf_BIT_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
282 offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
283 NULL, 0, hf_index, -1,
284 NULL);
286 return offset;
290 static const ber_sequence_t PKMACValue_sequence[] = {
291 { &hf_crmf_algId , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_AlgorithmIdentifier },
292 { &hf_crmf_pkmac_value , BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_crmf_BIT_STRING },
293 { NULL, 0, 0, 0, NULL }
296 static int
297 dissect_crmf_PKMACValue(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
298 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
299 PKMACValue_sequence, hf_index, ett_crmf_PKMACValue);
301 return offset;
305 static const value_string crmf_T_authInfo_vals[] = {
306 { 0, "sender" },
307 { 1, "publicKeyMAC" },
308 { 0, NULL }
311 static const ber_choice_t T_authInfo_choice[] = {
312 { 0, &hf_crmf_sender , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_pkix1implicit_GeneralName },
313 { 1, &hf_crmf_publicKeyMAC , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_PKMACValue },
314 { 0, NULL, 0, 0, 0, NULL }
317 static int
318 dissect_crmf_T_authInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
319 offset = dissect_ber_choice(actx, tree, tvb, offset,
320 T_authInfo_choice, hf_index, ett_crmf_T_authInfo,
321 NULL);
323 return offset;
327 static const ber_sequence_t POPOSigningKeyInput_sequence[] = {
328 { &hf_crmf_authInfo , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_crmf_T_authInfo },
329 { &hf_crmf_publicKey , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_SubjectPublicKeyInfo },
330 { NULL, 0, 0, 0, NULL }
333 static int
334 dissect_crmf_POPOSigningKeyInput(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
335 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
336 POPOSigningKeyInput_sequence, hf_index, ett_crmf_POPOSigningKeyInput);
338 return offset;
342 static const ber_sequence_t POPOSigningKey_sequence[] = {
343 { &hf_crmf_poposkInput , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crmf_POPOSigningKeyInput },
344 { &hf_crmf_algorithmIdentifier, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_AlgorithmIdentifier },
345 { &hf_crmf_sk_signature , BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_crmf_BIT_STRING },
346 { NULL, 0, 0, 0, NULL }
349 static int
350 dissect_crmf_POPOSigningKey(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
351 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
352 POPOSigningKey_sequence, hf_index, ett_crmf_POPOSigningKey);
354 return offset;
358 static const value_string crmf_SubsequentMessage_vals[] = {
359 { 0, "encrCert" },
360 { 1, "challengeResp" },
361 { 0, NULL }
365 static int
366 dissect_crmf_SubsequentMessage(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
367 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
368 NULL);
370 return offset;
374 static const value_string crmf_POPOPrivKey_vals[] = {
375 { 0, "thisMessage" },
376 { 1, "subsequentMessage" },
377 { 2, "dhMAC" },
378 { 3, "agreeMAC" },
379 { 4, "encryptedKey" },
380 { 0, NULL }
383 static const ber_choice_t POPOPrivKey_choice[] = {
384 { 0, &hf_crmf_thisMessage , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_crmf_BIT_STRING },
385 { 1, &hf_crmf_subsequentMessage, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_crmf_SubsequentMessage },
386 { 2, &hf_crmf_dhMAC , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_crmf_BIT_STRING },
387 { 3, &hf_crmf_agreeMAC , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_crmf_PKMACValue },
388 { 4, &hf_crmf_encryptedKey , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_cms_EnvelopedData },
389 { 0, NULL, 0, 0, 0, NULL }
392 static int
393 dissect_crmf_POPOPrivKey(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
394 offset = dissect_ber_choice(actx, tree, tvb, offset,
395 POPOPrivKey_choice, hf_index, ett_crmf_POPOPrivKey,
396 NULL);
398 return offset;
402 static const value_string crmf_ProofOfPossession_vals[] = {
403 { 0, "raVerified" },
404 { 1, "signature" },
405 { 2, "keyEncipherment" },
406 { 3, "keyAgreement" },
407 { 0, NULL }
410 static const ber_choice_t ProofOfPossession_choice[] = {
411 { 0, &hf_crmf_raVerified , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_crmf_NULL },
412 { 1, &hf_crmf_signature , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_crmf_POPOSigningKey },
413 { 2, &hf_crmf_keyEncipherment, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_crmf_POPOPrivKey },
414 { 3, &hf_crmf_keyAgreement , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_crmf_POPOPrivKey },
415 { 0, NULL, 0, 0, 0, NULL }
418 static int
419 dissect_crmf_ProofOfPossession(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
420 offset = dissect_ber_choice(actx, tree, tvb, offset,
421 ProofOfPossession_choice, hf_index, ett_crmf_ProofOfPossession,
422 NULL);
424 return offset;
428 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue_sequence_of[1] = {
429 { &hf_crmf_regInfo_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_AttributeTypeAndValue },
432 static int
433 dissect_crmf_SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
434 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
435 SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue_sequence_of, hf_index, ett_crmf_SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue);
437 return offset;
441 static const ber_sequence_t CertReqMsg_sequence[] = {
442 { &hf_crmf_certReq , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_CertRequest },
443 { &hf_crmf_popo , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_crmf_ProofOfPossession },
444 { &hf_crmf_regInfo , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_crmf_SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue },
445 { NULL, 0, 0, 0, NULL }
448 static int
449 dissect_crmf_CertReqMsg(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
450 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
451 CertReqMsg_sequence, hf_index, ett_crmf_CertReqMsg);
453 return offset;
457 static const ber_sequence_t CertReqMessages_sequence_of[1] = {
458 { &hf_crmf_CertReqMessages_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_CertReqMsg },
462 dissect_crmf_CertReqMessages(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
463 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
464 CertReqMessages_sequence_of, hf_index, ett_crmf_CertReqMessages);
466 return offset;
471 static int
472 dissect_crmf_OCTET_STRING(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
473 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
474 NULL);
476 return offset;
480 static const ber_sequence_t PBMParameter_sequence[] = {
481 { &hf_crmf_salt , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_crmf_OCTET_STRING },
482 { &hf_crmf_owf , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_AlgorithmIdentifier },
483 { &hf_crmf_iterationCount , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_crmf_INTEGER },
484 { &hf_crmf_mac , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_AlgorithmIdentifier },
485 { NULL, 0, 0, 0, NULL }
488 static int
489 dissect_crmf_PBMParameter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
490 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
491 PBMParameter_sequence, hf_index, ett_crmf_PBMParameter);
493 return offset;
498 static int
499 dissect_crmf_RegToken(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
500 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
501 actx, tree, tvb, offset, hf_index,
502 NULL);
504 return offset;
509 static int
510 dissect_crmf_Authenticator(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
511 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
512 actx, tree, tvb, offset, hf_index,
513 NULL);
515 return offset;
519 static const value_string crmf_T_action_vals[] = {
520 { 0, "dontPublish" },
521 { 1, "pleasePublish" },
522 { 0, NULL }
526 static int
527 dissect_crmf_T_action(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
528 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
529 NULL);
531 return offset;
535 static const value_string crmf_T_pubMethod_vals[] = {
536 { 0, "dontCare" },
537 { 1, "x500" },
538 { 2, "web" },
539 { 3, "ldap" },
540 { 0, NULL }
544 static int
545 dissect_crmf_T_pubMethod(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
546 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
547 NULL);
549 return offset;
553 static const ber_sequence_t SinglePubInfo_sequence[] = {
554 { &hf_crmf_pubMethod , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_crmf_T_pubMethod },
555 { &hf_crmf_pubLocation , BER_CLASS_CON, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_pkix1implicit_GeneralName },
556 { NULL, 0, 0, 0, NULL }
559 static int
560 dissect_crmf_SinglePubInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
561 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
562 SinglePubInfo_sequence, hf_index, ett_crmf_SinglePubInfo);
564 return offset;
568 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo_sequence_of[1] = {
569 { &hf_crmf_pubInfos_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_SinglePubInfo },
572 static int
573 dissect_crmf_SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
574 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
575 SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo_sequence_of, hf_index, ett_crmf_SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo);
577 return offset;
581 static const ber_sequence_t PKIPublicationInfo_sequence[] = {
582 { &hf_crmf_action , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_crmf_T_action },
583 { &hf_crmf_pubInfos , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_crmf_SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo },
584 { NULL, 0, 0, 0, NULL }
588 dissect_crmf_PKIPublicationInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
589 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
590 PKIPublicationInfo_sequence, hf_index, ett_crmf_PKIPublicationInfo);
592 return offset;
596 static const ber_sequence_t EncryptedValue_sequence[] = {
597 { &hf_crmf_intendedAlg , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_AlgorithmIdentifier },
598 { &hf_crmf_symmAlg , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_AlgorithmIdentifier },
599 { &hf_crmf_encSymmKey , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crmf_BIT_STRING },
600 { &hf_crmf_keyAlg , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_pkix1explicit_AlgorithmIdentifier },
601 { &hf_crmf_valueHint , BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crmf_OCTET_STRING },
602 { &hf_crmf_encValue , BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_NOOWNTAG, dissect_crmf_BIT_STRING },
603 { NULL, 0, 0, 0, NULL }
607 dissect_crmf_EncryptedValue(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
608 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
609 EncryptedValue_sequence, hf_index, ett_crmf_EncryptedValue);
611 return offset;
615 static const value_string crmf_EncryptedKey_vals[] = {
616 { 0, "encryptedValue" },
617 { 1, "envelopedData" },
618 { 0, NULL }
621 static const ber_choice_t EncryptedKey_choice[] = {
622 { 0, &hf_crmf_encryptedValue , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_EncryptedValue },
623 { 1, &hf_crmf_envelopedData , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_cms_EnvelopedData },
624 { 0, NULL, 0, 0, 0, NULL }
627 static int
628 dissect_crmf_EncryptedKey(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
629 offset = dissect_ber_choice(actx, tree, tvb, offset,
630 EncryptedKey_choice, hf_index, ett_crmf_EncryptedKey,
631 NULL);
633 return offset;
638 static int
639 dissect_crmf_KeyGenParameters(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
640 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
641 NULL);
643 return offset;
648 static int
649 dissect_crmf_BOOLEAN(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
650 offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
652 return offset;
656 static const value_string crmf_PKIArchiveOptions_vals[] = {
657 { 0, "encryptedPrivKey" },
658 { 1, "keyGenParameters" },
659 { 2, "archiveRemGenPrivKey" },
660 { 0, NULL }
663 static const ber_choice_t PKIArchiveOptions_choice[] = {
664 { 0, &hf_crmf_encryptedPrivKey, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_crmf_EncryptedKey },
665 { 1, &hf_crmf_keyGenParameters, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_crmf_KeyGenParameters },
666 { 2, &hf_crmf_archiveRemGenPrivKey, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_crmf_BOOLEAN },
667 { 0, NULL, 0, 0, 0, NULL }
670 static int
671 dissect_crmf_PKIArchiveOptions(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
672 offset = dissect_ber_choice(actx, tree, tvb, offset,
673 PKIArchiveOptions_choice, hf_index, ett_crmf_PKIArchiveOptions,
674 NULL);
676 return offset;
680 static const ber_sequence_t CertId_sequence[] = {
681 { &hf_crmf_issuer , BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_pkix1implicit_GeneralName },
682 { &hf_crmf_serialNumber , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_crmf_INTEGER_MIN_MAX },
683 { NULL, 0, 0, 0, NULL }
687 dissect_crmf_CertId(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
688 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
689 CertId_sequence, hf_index, ett_crmf_CertId);
691 return offset;
696 static int
697 dissect_crmf_OldCertId(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
698 offset = dissect_crmf_CertId(implicit_tag, tvb, offset, actx, tree, hf_index);
700 return offset;
705 static int
706 dissect_crmf_ProtocolEncrKey(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
707 offset = dissect_pkix1explicit_SubjectPublicKeyInfo(implicit_tag, tvb, offset, actx, tree, hf_index);
709 return offset;
714 static int
715 dissect_crmf_UTF8Pairs(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
716 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
717 actx, tree, tvb, offset, hf_index,
718 NULL);
720 return offset;
725 static int
726 dissect_crmf_CertReq(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
727 offset = dissect_crmf_CertRequest(implicit_tag, tvb, offset, actx, tree, hf_index);
729 return offset;
733 static const ber_sequence_t Attributes_set_of[1] = {
734 { &hf_crmf_Attributes_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_Attribute },
737 static int
738 dissect_crmf_Attributes(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
739 offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
740 Attributes_set_of, hf_index, ett_crmf_Attributes);
742 return offset;
746 static const ber_sequence_t PrivateKeyInfo_sequence[] = {
747 { &hf_crmf_privkey_version, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_crmf_INTEGER },
748 { &hf_crmf_privateKeyAlgorithm, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_pkix1explicit_AlgorithmIdentifier },
749 { &hf_crmf_privateKey , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_crmf_OCTET_STRING },
750 { &hf_crmf_attributes , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_crmf_Attributes },
751 { NULL, 0, 0, 0, NULL }
754 static int
755 dissect_crmf_PrivateKeyInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
756 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
757 PrivateKeyInfo_sequence, hf_index, ett_crmf_PrivateKeyInfo);
759 return offset;
764 static int
765 dissect_crmf_UTF8String(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
766 offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_UTF8String,
767 actx, tree, tvb, offset, hf_index,
768 NULL);
770 return offset;
774 static const value_string crmf_T_identifier_vals[] = {
775 { 0, "string" },
776 { 1, "generalName" },
777 { 0, NULL }
780 static const ber_choice_t T_identifier_choice[] = {
781 { 0, &hf_crmf_string , BER_CLASS_UNI, BER_UNI_TAG_UTF8String, BER_FLAGS_NOOWNTAG, dissect_crmf_UTF8String },
782 { 1, &hf_crmf_generalName , BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_pkix1implicit_GeneralName },
783 { 0, NULL, 0, 0, 0, NULL }
786 static int
787 dissect_crmf_T_identifier(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
788 offset = dissect_ber_choice(actx, tree, tvb, offset,
789 T_identifier_choice, hf_index, ett_crmf_T_identifier,
790 NULL);
792 return offset;
796 static const ber_sequence_t EncKeyWithID_sequence[] = {
797 { &hf_crmf_enckeywid_privkey, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_crmf_PrivateKeyInfo },
798 { &hf_crmf_identifier , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_crmf_T_identifier },
799 { NULL, 0, 0, 0, NULL }
802 static int
803 dissect_crmf_EncKeyWithID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
804 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
805 EncKeyWithID_sequence, hf_index, ett_crmf_EncKeyWithID);
807 return offset;
810 /*--- PDUs ---*/
812 static int dissect_PBMParameter_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
813 int offset = 0;
814 asn1_ctx_t asn1_ctx;
815 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
816 offset = dissect_crmf_PBMParameter(false, tvb, offset, &asn1_ctx, tree, hf_crmf_PBMParameter_PDU);
817 return offset;
819 static int dissect_RegToken_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
820 int offset = 0;
821 asn1_ctx_t asn1_ctx;
822 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
823 offset = dissect_crmf_RegToken(false, tvb, offset, &asn1_ctx, tree, hf_crmf_RegToken_PDU);
824 return offset;
826 static int dissect_Authenticator_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
827 int offset = 0;
828 asn1_ctx_t asn1_ctx;
829 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
830 offset = dissect_crmf_Authenticator(false, tvb, offset, &asn1_ctx, tree, hf_crmf_Authenticator_PDU);
831 return offset;
833 static int dissect_PKIPublicationInfo_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
834 int offset = 0;
835 asn1_ctx_t asn1_ctx;
836 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
837 offset = dissect_crmf_PKIPublicationInfo(false, tvb, offset, &asn1_ctx, tree, hf_crmf_PKIPublicationInfo_PDU);
838 return offset;
840 static int dissect_PKIArchiveOptions_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
841 int offset = 0;
842 asn1_ctx_t asn1_ctx;
843 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
844 offset = dissect_crmf_PKIArchiveOptions(false, tvb, offset, &asn1_ctx, tree, hf_crmf_PKIArchiveOptions_PDU);
845 return offset;
847 static int dissect_OldCertId_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
848 int offset = 0;
849 asn1_ctx_t asn1_ctx;
850 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
851 offset = dissect_crmf_OldCertId(false, tvb, offset, &asn1_ctx, tree, hf_crmf_OldCertId_PDU);
852 return offset;
854 static int dissect_ProtocolEncrKey_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
855 int offset = 0;
856 asn1_ctx_t asn1_ctx;
857 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
858 offset = dissect_crmf_ProtocolEncrKey(false, tvb, offset, &asn1_ctx, tree, hf_crmf_ProtocolEncrKey_PDU);
859 return offset;
861 static int dissect_UTF8Pairs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
862 int offset = 0;
863 asn1_ctx_t asn1_ctx;
864 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
865 offset = dissect_crmf_UTF8Pairs(false, tvb, offset, &asn1_ctx, tree, hf_crmf_UTF8Pairs_PDU);
866 return offset;
868 static int dissect_CertReq_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
869 int offset = 0;
870 asn1_ctx_t asn1_ctx;
871 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
872 offset = dissect_crmf_CertReq(false, tvb, offset, &asn1_ctx, tree, hf_crmf_CertReq_PDU);
873 return offset;
875 static int dissect_EncKeyWithID_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
876 int offset = 0;
877 asn1_ctx_t asn1_ctx;
878 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, true, pinfo);
879 offset = dissect_crmf_EncKeyWithID(false, tvb, offset, &asn1_ctx, tree, hf_crmf_EncKeyWithID_PDU);
880 return offset;
885 /*--- proto_register_crmf ----------------------------------------------*/
886 void proto_register_crmf(void) {
888 /* List of fields */
889 static hf_register_info hf[] = {
890 { &hf_crmf_type_oid,
891 { "Type", "crmf.type.oid",
892 FT_STRING, BASE_NONE, NULL, 0,
893 "Type of AttributeTypeAndValue", HFILL }},
894 { &hf_crmf_PBMParameter_PDU,
895 { "PBMParameter", "crmf.PBMParameter_element",
896 FT_NONE, BASE_NONE, NULL, 0,
897 NULL, HFILL }},
898 { &hf_crmf_RegToken_PDU,
899 { "RegToken", "crmf.RegToken",
900 FT_STRING, BASE_NONE, NULL, 0,
901 NULL, HFILL }},
902 { &hf_crmf_Authenticator_PDU,
903 { "Authenticator", "crmf.Authenticator",
904 FT_STRING, BASE_NONE, NULL, 0,
905 NULL, HFILL }},
906 { &hf_crmf_PKIPublicationInfo_PDU,
907 { "PKIPublicationInfo", "crmf.PKIPublicationInfo_element",
908 FT_NONE, BASE_NONE, NULL, 0,
909 NULL, HFILL }},
910 { &hf_crmf_PKIArchiveOptions_PDU,
911 { "PKIArchiveOptions", "crmf.PKIArchiveOptions",
912 FT_UINT32, BASE_DEC, VALS(crmf_PKIArchiveOptions_vals), 0,
913 NULL, HFILL }},
914 { &hf_crmf_OldCertId_PDU,
915 { "OldCertId", "crmf.OldCertId_element",
916 FT_NONE, BASE_NONE, NULL, 0,
917 NULL, HFILL }},
918 { &hf_crmf_ProtocolEncrKey_PDU,
919 { "ProtocolEncrKey", "crmf.ProtocolEncrKey_element",
920 FT_NONE, BASE_NONE, NULL, 0,
921 NULL, HFILL }},
922 { &hf_crmf_UTF8Pairs_PDU,
923 { "UTF8Pairs", "crmf.UTF8Pairs",
924 FT_STRING, BASE_NONE, NULL, 0,
925 NULL, HFILL }},
926 { &hf_crmf_CertReq_PDU,
927 { "CertReq", "crmf.CertReq_element",
928 FT_NONE, BASE_NONE, NULL, 0,
929 NULL, HFILL }},
930 { &hf_crmf_EncKeyWithID_PDU,
931 { "EncKeyWithID", "crmf.EncKeyWithID_element",
932 FT_NONE, BASE_NONE, NULL, 0,
933 NULL, HFILL }},
934 { &hf_crmf_CertReqMessages_item,
935 { "CertReqMsg", "crmf.CertReqMsg_element",
936 FT_NONE, BASE_NONE, NULL, 0,
937 NULL, HFILL }},
938 { &hf_crmf_certReq,
939 { "certReq", "crmf.certReq_element",
940 FT_NONE, BASE_NONE, NULL, 0,
941 "CertRequest", HFILL }},
942 { &hf_crmf_popo,
943 { "popo", "crmf.popo",
944 FT_UINT32, BASE_DEC, VALS(crmf_ProofOfPossession_vals), 0,
945 "ProofOfPossession", HFILL }},
946 { &hf_crmf_regInfo,
947 { "regInfo", "crmf.regInfo",
948 FT_UINT32, BASE_DEC, NULL, 0,
949 "SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue", HFILL }},
950 { &hf_crmf_regInfo_item,
951 { "AttributeTypeAndValue", "crmf.AttributeTypeAndValue_element",
952 FT_NONE, BASE_NONE, NULL, 0,
953 NULL, HFILL }},
954 { &hf_crmf_certReqId,
955 { "certReqId", "crmf.certReqId",
956 FT_INT32, BASE_DEC, NULL, 0,
957 "INTEGER", HFILL }},
958 { &hf_crmf_certTemplate,
959 { "certTemplate", "crmf.certTemplate_element",
960 FT_NONE, BASE_NONE, NULL, 0,
961 NULL, HFILL }},
962 { &hf_crmf_controls,
963 { "controls", "crmf.controls",
964 FT_UINT32, BASE_DEC, NULL, 0,
965 NULL, HFILL }},
966 { &hf_crmf_version,
967 { "version", "crmf.version",
968 FT_INT32, BASE_DEC, VALS(pkix1explicit_Version_vals), 0,
969 NULL, HFILL }},
970 { &hf_crmf_serialNumber,
971 { "serialNumber", "crmf.serialNumber",
972 FT_INT64, BASE_DEC, NULL, 0,
973 "INTEGER_MIN_MAX", HFILL }},
974 { &hf_crmf_signingAlg,
975 { "signingAlg", "crmf.signingAlg_element",
976 FT_NONE, BASE_NONE, NULL, 0,
977 "AlgorithmIdentifier", HFILL }},
978 { &hf_crmf_template_issuer,
979 { "issuer", "crmf.issuer",
980 FT_UINT32, BASE_DEC, NULL, 0,
981 "Name", HFILL }},
982 { &hf_crmf_validity,
983 { "validity", "crmf.validity_element",
984 FT_NONE, BASE_NONE, NULL, 0,
985 "OptionalValidity", HFILL }},
986 { &hf_crmf_subject,
987 { "subject", "crmf.subject",
988 FT_UINT32, BASE_DEC, NULL, 0,
989 "Name", HFILL }},
990 { &hf_crmf_publicKey,
991 { "publicKey", "crmf.publicKey_element",
992 FT_NONE, BASE_NONE, NULL, 0,
993 "SubjectPublicKeyInfo", HFILL }},
994 { &hf_crmf_issuerUID,
995 { "issuerUID", "crmf.issuerUID",
996 FT_BYTES, BASE_NONE, NULL, 0,
997 "UniqueIdentifier", HFILL }},
998 { &hf_crmf_subjectUID,
999 { "subjectUID", "crmf.subjectUID",
1000 FT_BYTES, BASE_NONE, NULL, 0,
1001 "UniqueIdentifier", HFILL }},
1002 { &hf_crmf_extensions,
1003 { "extensions", "crmf.extensions",
1004 FT_UINT32, BASE_DEC, NULL, 0,
1005 NULL, HFILL }},
1006 { &hf_crmf_notBefore,
1007 { "notBefore", "crmf.notBefore",
1008 FT_UINT32, BASE_DEC, VALS(pkix1explicit_Time_vals), 0,
1009 "Time", HFILL }},
1010 { &hf_crmf_notAfter,
1011 { "notAfter", "crmf.notAfter",
1012 FT_UINT32, BASE_DEC, VALS(pkix1explicit_Time_vals), 0,
1013 "Time", HFILL }},
1014 { &hf_crmf_Controls_item,
1015 { "AttributeTypeAndValue", "crmf.AttributeTypeAndValue_element",
1016 FT_NONE, BASE_NONE, NULL, 0,
1017 NULL, HFILL }},
1018 { &hf_crmf_type,
1019 { "type", "crmf.type",
1020 FT_OID, BASE_NONE, NULL, 0,
1021 NULL, HFILL }},
1022 { &hf_crmf_value,
1023 { "value", "crmf.value_element",
1024 FT_NONE, BASE_NONE, NULL, 0,
1025 NULL, HFILL }},
1026 { &hf_crmf_raVerified,
1027 { "raVerified", "crmf.raVerified_element",
1028 FT_NONE, BASE_NONE, NULL, 0,
1029 NULL, HFILL }},
1030 { &hf_crmf_signature,
1031 { "signature", "crmf.signature_element",
1032 FT_NONE, BASE_NONE, NULL, 0,
1033 "POPOSigningKey", HFILL }},
1034 { &hf_crmf_keyEncipherment,
1035 { "keyEncipherment", "crmf.keyEncipherment",
1036 FT_UINT32, BASE_DEC, VALS(crmf_POPOPrivKey_vals), 0,
1037 "POPOPrivKey", HFILL }},
1038 { &hf_crmf_keyAgreement,
1039 { "keyAgreement", "crmf.keyAgreement",
1040 FT_UINT32, BASE_DEC, VALS(crmf_POPOPrivKey_vals), 0,
1041 "POPOPrivKey", HFILL }},
1042 { &hf_crmf_poposkInput,
1043 { "poposkInput", "crmf.poposkInput_element",
1044 FT_NONE, BASE_NONE, NULL, 0,
1045 "POPOSigningKeyInput", HFILL }},
1046 { &hf_crmf_algorithmIdentifier,
1047 { "algorithmIdentifier", "crmf.algorithmIdentifier_element",
1048 FT_NONE, BASE_NONE, NULL, 0,
1049 NULL, HFILL }},
1050 { &hf_crmf_sk_signature,
1051 { "signature", "crmf.signature",
1052 FT_BYTES, BASE_NONE, NULL, 0,
1053 "BIT_STRING", HFILL }},
1054 { &hf_crmf_authInfo,
1055 { "authInfo", "crmf.authInfo",
1056 FT_UINT32, BASE_DEC, VALS(crmf_T_authInfo_vals), 0,
1057 NULL, HFILL }},
1058 { &hf_crmf_sender,
1059 { "sender", "crmf.sender",
1060 FT_UINT32, BASE_DEC, NULL, 0,
1061 "GeneralName", HFILL }},
1062 { &hf_crmf_publicKeyMAC,
1063 { "publicKeyMAC", "crmf.publicKeyMAC_element",
1064 FT_NONE, BASE_NONE, NULL, 0,
1065 "PKMACValue", HFILL }},
1066 { &hf_crmf_algId,
1067 { "algId", "crmf.algId_element",
1068 FT_NONE, BASE_NONE, NULL, 0,
1069 "AlgorithmIdentifier", HFILL }},
1070 { &hf_crmf_pkmac_value,
1071 { "value", "crmf.value",
1072 FT_BYTES, BASE_NONE, NULL, 0,
1073 "BIT_STRING", HFILL }},
1074 { &hf_crmf_salt,
1075 { "salt", "crmf.salt",
1076 FT_BYTES, BASE_NONE, NULL, 0,
1077 "OCTET_STRING", HFILL }},
1078 { &hf_crmf_owf,
1079 { "owf", "crmf.owf_element",
1080 FT_NONE, BASE_NONE, NULL, 0,
1081 "AlgorithmIdentifier", HFILL }},
1082 { &hf_crmf_iterationCount,
1083 { "iterationCount", "crmf.iterationCount",
1084 FT_INT32, BASE_DEC, NULL, 0,
1085 "INTEGER", HFILL }},
1086 { &hf_crmf_mac,
1087 { "mac", "crmf.mac_element",
1088 FT_NONE, BASE_NONE, NULL, 0,
1089 "AlgorithmIdentifier", HFILL }},
1090 { &hf_crmf_thisMessage,
1091 { "thisMessage", "crmf.thisMessage",
1092 FT_BYTES, BASE_NONE, NULL, 0,
1093 "BIT_STRING", HFILL }},
1094 { &hf_crmf_subsequentMessage,
1095 { "subsequentMessage", "crmf.subsequentMessage",
1096 FT_INT32, BASE_DEC, VALS(crmf_SubsequentMessage_vals), 0,
1097 NULL, HFILL }},
1098 { &hf_crmf_dhMAC,
1099 { "dhMAC", "crmf.dhMAC",
1100 FT_BYTES, BASE_NONE, NULL, 0,
1101 "BIT_STRING", HFILL }},
1102 { &hf_crmf_agreeMAC,
1103 { "agreeMAC", "crmf.agreeMAC_element",
1104 FT_NONE, BASE_NONE, NULL, 0,
1105 "PKMACValue", HFILL }},
1106 { &hf_crmf_encryptedKey,
1107 { "encryptedKey", "crmf.encryptedKey_element",
1108 FT_NONE, BASE_NONE, NULL, 0,
1109 "EnvelopedData", HFILL }},
1110 { &hf_crmf_action,
1111 { "action", "crmf.action",
1112 FT_INT32, BASE_DEC, VALS(crmf_T_action_vals), 0,
1113 NULL, HFILL }},
1114 { &hf_crmf_pubInfos,
1115 { "pubInfos", "crmf.pubInfos",
1116 FT_UINT32, BASE_DEC, NULL, 0,
1117 "SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo", HFILL }},
1118 { &hf_crmf_pubInfos_item,
1119 { "SinglePubInfo", "crmf.SinglePubInfo_element",
1120 FT_NONE, BASE_NONE, NULL, 0,
1121 NULL, HFILL }},
1122 { &hf_crmf_pubMethod,
1123 { "pubMethod", "crmf.pubMethod",
1124 FT_INT32, BASE_DEC, VALS(crmf_T_pubMethod_vals), 0,
1125 NULL, HFILL }},
1126 { &hf_crmf_pubLocation,
1127 { "pubLocation", "crmf.pubLocation",
1128 FT_UINT32, BASE_DEC, NULL, 0,
1129 "GeneralName", HFILL }},
1130 { &hf_crmf_encryptedPrivKey,
1131 { "encryptedPrivKey", "crmf.encryptedPrivKey",
1132 FT_UINT32, BASE_DEC, VALS(crmf_EncryptedKey_vals), 0,
1133 "EncryptedKey", HFILL }},
1134 { &hf_crmf_keyGenParameters,
1135 { "keyGenParameters", "crmf.keyGenParameters",
1136 FT_BYTES, BASE_NONE, NULL, 0,
1137 NULL, HFILL }},
1138 { &hf_crmf_archiveRemGenPrivKey,
1139 { "archiveRemGenPrivKey", "crmf.archiveRemGenPrivKey",
1140 FT_BOOLEAN, BASE_NONE, NULL, 0,
1141 "BOOLEAN", HFILL }},
1142 { &hf_crmf_encryptedValue,
1143 { "encryptedValue", "crmf.encryptedValue_element",
1144 FT_NONE, BASE_NONE, NULL, 0,
1145 NULL, HFILL }},
1146 { &hf_crmf_envelopedData,
1147 { "envelopedData", "crmf.envelopedData_element",
1148 FT_NONE, BASE_NONE, NULL, 0,
1149 NULL, HFILL }},
1150 { &hf_crmf_intendedAlg,
1151 { "intendedAlg", "crmf.intendedAlg_element",
1152 FT_NONE, BASE_NONE, NULL, 0,
1153 "AlgorithmIdentifier", HFILL }},
1154 { &hf_crmf_symmAlg,
1155 { "symmAlg", "crmf.symmAlg_element",
1156 FT_NONE, BASE_NONE, NULL, 0,
1157 "AlgorithmIdentifier", HFILL }},
1158 { &hf_crmf_encSymmKey,
1159 { "encSymmKey", "crmf.encSymmKey",
1160 FT_BYTES, BASE_NONE, NULL, 0,
1161 "BIT_STRING", HFILL }},
1162 { &hf_crmf_keyAlg,
1163 { "keyAlg", "crmf.keyAlg_element",
1164 FT_NONE, BASE_NONE, NULL, 0,
1165 "AlgorithmIdentifier", HFILL }},
1166 { &hf_crmf_valueHint,
1167 { "valueHint", "crmf.valueHint",
1168 FT_BYTES, BASE_NONE, NULL, 0,
1169 "OCTET_STRING", HFILL }},
1170 { &hf_crmf_encValue,
1171 { "encValue", "crmf.encValue",
1172 FT_BYTES, BASE_NONE, NULL, 0,
1173 "BIT_STRING", HFILL }},
1174 { &hf_crmf_issuer,
1175 { "issuer", "crmf.issuer",
1176 FT_UINT32, BASE_DEC, NULL, 0,
1177 "GeneralName", HFILL }},
1178 { &hf_crmf_enckeywid_privkey,
1179 { "privateKey", "crmf.privateKey_element",
1180 FT_NONE, BASE_NONE, NULL, 0,
1181 "PrivateKeyInfo", HFILL }},
1182 { &hf_crmf_identifier,
1183 { "identifier", "crmf.identifier",
1184 FT_UINT32, BASE_DEC, VALS(crmf_T_identifier_vals), 0,
1185 NULL, HFILL }},
1186 { &hf_crmf_string,
1187 { "string", "crmf.string",
1188 FT_STRING, BASE_NONE, NULL, 0,
1189 "UTF8String", HFILL }},
1190 { &hf_crmf_generalName,
1191 { "generalName", "crmf.generalName",
1192 FT_UINT32, BASE_DEC, NULL, 0,
1193 NULL, HFILL }},
1194 { &hf_crmf_privkey_version,
1195 { "version", "crmf.version",
1196 FT_INT32, BASE_DEC, NULL, 0,
1197 "INTEGER", HFILL }},
1198 { &hf_crmf_privateKeyAlgorithm,
1199 { "privateKeyAlgorithm", "crmf.privateKeyAlgorithm_element",
1200 FT_NONE, BASE_NONE, NULL, 0,
1201 "AlgorithmIdentifier", HFILL }},
1202 { &hf_crmf_privateKey,
1203 { "privateKey", "crmf.privateKey",
1204 FT_BYTES, BASE_NONE, NULL, 0,
1205 "OCTET_STRING", HFILL }},
1206 { &hf_crmf_attributes,
1207 { "attributes", "crmf.attributes",
1208 FT_UINT32, BASE_DEC, NULL, 0,
1209 NULL, HFILL }},
1210 { &hf_crmf_Attributes_item,
1211 { "Attribute", "crmf.Attribute_element",
1212 FT_NONE, BASE_NONE, NULL, 0,
1213 NULL, HFILL }},
1216 /* List of subtrees */
1217 static int *ett[] = {
1218 &ett_crmf_CertReqMessages,
1219 &ett_crmf_CertReqMsg,
1220 &ett_crmf_SEQUENCE_SIZE_1_MAX_OF_AttributeTypeAndValue,
1221 &ett_crmf_CertRequest,
1222 &ett_crmf_CertTemplate,
1223 &ett_crmf_OptionalValidity,
1224 &ett_crmf_Controls,
1225 &ett_crmf_AttributeTypeAndValue,
1226 &ett_crmf_ProofOfPossession,
1227 &ett_crmf_POPOSigningKey,
1228 &ett_crmf_POPOSigningKeyInput,
1229 &ett_crmf_T_authInfo,
1230 &ett_crmf_PKMACValue,
1231 &ett_crmf_PBMParameter,
1232 &ett_crmf_POPOPrivKey,
1233 &ett_crmf_PKIPublicationInfo,
1234 &ett_crmf_SEQUENCE_SIZE_1_MAX_OF_SinglePubInfo,
1235 &ett_crmf_SinglePubInfo,
1236 &ett_crmf_PKIArchiveOptions,
1237 &ett_crmf_EncryptedKey,
1238 &ett_crmf_EncryptedValue,
1239 &ett_crmf_CertId,
1240 &ett_crmf_EncKeyWithID,
1241 &ett_crmf_T_identifier,
1242 &ett_crmf_PrivateKeyInfo,
1243 &ett_crmf_Attributes,
1246 /* Register protocol */
1247 proto_crmf = proto_register_protocol(PNAME, PSNAME, PFNAME);
1249 /* Register fields and subtrees */
1250 proto_register_field_array(proto_crmf, hf, array_length(hf));
1251 proto_register_subtree_array(ett, array_length(ett));
1256 /*--- proto_reg_handoff_crmf -------------------------------------------*/
1257 void proto_reg_handoff_crmf(void) {
1258 oid_add_from_string("id-pkip","1.3.6.1.5.5.7.5");
1259 oid_add_from_string("id-regCtrl","1.3.6.1.5.5.7.5.1");
1260 oid_add_from_string("id-regInfo","1.3.6.1.5.5.7.5.2");
1261 register_ber_oid_dissector("1.2.840.113549.1.9.16.1.21", dissect_EncKeyWithID_PDU, proto_crmf, "id-ct-encKeyWithID");
1262 register_ber_oid_dissector("1.2.840.113533.7.66.13", dissect_PBMParameter_PDU, proto_crmf, "PasswordBasedMac");
1263 register_ber_oid_dissector("1.3.6.1.5.5.7.5.1.1", dissect_RegToken_PDU, proto_crmf, "id-regCtrl-regToken");
1264 register_ber_oid_dissector("1.3.6.1.5.5.7.5.1.2", dissect_Authenticator_PDU, proto_crmf, "id-regCtrl-authenticator");
1265 register_ber_oid_dissector("1.3.6.1.5.5.7.5.1.3", dissect_PKIPublicationInfo_PDU, proto_crmf, "id-regCtrl-pkiPublicationInfo");
1266 register_ber_oid_dissector("1.3.6.1.5.5.7.5.1.4", dissect_PKIArchiveOptions_PDU, proto_crmf, "id-regCtrl-pkiArchiveOptions");
1267 register_ber_oid_dissector("1.3.6.1.5.5.7.5.1.5", dissect_OldCertId_PDU, proto_crmf, "id-regCtrl-oldCertID");
1268 register_ber_oid_dissector("1.3.6.1.5.5.7.5.1.6", dissect_ProtocolEncrKey_PDU, proto_crmf, "id-regCtrl-protocolEncrKey");
1269 register_ber_oid_dissector("1.3.6.1.5.5.7.5.2.1", dissect_UTF8Pairs_PDU, proto_crmf, "id-regInfo-utf8Pairs");
1270 register_ber_oid_dissector("1.3.6.1.5.5.7.5.2.2", dissect_CertReq_PDU, proto_crmf, "id-regInfo-certReq");