1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-ns_cert_exts.c */
4 /* asn2wrs.py -b -q -L -p ns_cert_exts -c ./ns_cert_exts.cnf -s ./packet-ns_cert_exts-template -D . -O ../.. NETSCAPE-CERT-EXTS.asn */
6 /* packet-ns_cert_exts.c
7 * Routines for NetScape Certificate Extensions packet dissection
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
19 #include <epan/packet.h>
20 #include <wsutil/array.h>
22 #include "packet-ber.h"
24 #define PNAME "NetScape Certificate Extensions"
25 #define PSNAME "NS_CERT_EXTS"
26 #define PFNAME "ns_cert_exts"
28 void proto_register_ns_cert_exts(void);
29 void proto_reg_handoff_ns_cert_exts(void);
31 /* Initialize the protocol and registered fields */
32 static int proto_ns_cert_exts
;
33 static int hf_ns_cert_exts_BaseUrl_PDU
; /* BaseUrl */
34 static int hf_ns_cert_exts_RevocationUrl_PDU
; /* RevocationUrl */
35 static int hf_ns_cert_exts_CaRevocationUrl_PDU
; /* CaRevocationUrl */
36 static int hf_ns_cert_exts_CaPolicyUrl_PDU
; /* CaPolicyUrl */
37 static int hf_ns_cert_exts_Comment_PDU
; /* Comment */
38 static int hf_ns_cert_exts_SslServerName_PDU
; /* SslServerName */
39 static int hf_ns_cert_exts_CertRenewalUrl_PDU
; /* CertRenewalUrl */
40 static int hf_ns_cert_exts_CertType_PDU
; /* CertType */
42 static int hf_ns_cert_exts_CertType_ssl_client
;
43 static int hf_ns_cert_exts_CertType_ssl_server
;
44 static int hf_ns_cert_exts_CertType_smime
;
45 static int hf_ns_cert_exts_CertType_object_signing
;
46 static int hf_ns_cert_exts_CertType_reserved_for_future_use
;
47 static int hf_ns_cert_exts_CertType_ssl_ca
;
48 static int hf_ns_cert_exts_CertType_smime_ca
;
49 static int hf_ns_cert_exts_CertType_object_signing_ca
;
51 /* Initialize the subtree pointers */
52 static int ett_ns_cert_exts_CertType
;
57 dissect_ns_cert_exts_BaseUrl(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
58 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
59 actx
, tree
, tvb
, offset
, hf_index
,
68 dissect_ns_cert_exts_RevocationUrl(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
69 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
70 actx
, tree
, tvb
, offset
, hf_index
,
79 dissect_ns_cert_exts_CaRevocationUrl(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
80 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
81 actx
, tree
, tvb
, offset
, hf_index
,
90 dissect_ns_cert_exts_CaPolicyUrl(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
91 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
92 actx
, tree
, tvb
, offset
, hf_index
,
101 dissect_ns_cert_exts_Comment(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
102 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
103 actx
, tree
, tvb
, offset
, hf_index
,
112 dissect_ns_cert_exts_SslServerName(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
113 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
114 actx
, tree
, tvb
, offset
, hf_index
,
123 dissect_ns_cert_exts_CertRenewalUrl(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
124 offset
= dissect_ber_restricted_string(implicit_tag
, BER_UNI_TAG_IA5String
,
125 actx
, tree
, tvb
, offset
, hf_index
,
132 static int * const CertType_bits
[] = {
133 &hf_ns_cert_exts_CertType_ssl_client
,
134 &hf_ns_cert_exts_CertType_ssl_server
,
135 &hf_ns_cert_exts_CertType_smime
,
136 &hf_ns_cert_exts_CertType_object_signing
,
137 &hf_ns_cert_exts_CertType_reserved_for_future_use
,
138 &hf_ns_cert_exts_CertType_ssl_ca
,
139 &hf_ns_cert_exts_CertType_smime_ca
,
140 &hf_ns_cert_exts_CertType_object_signing_ca
,
145 dissect_ns_cert_exts_CertType(bool implicit_tag _U_
, tvbuff_t
*tvb _U_
, int offset _U_
, asn1_ctx_t
*actx _U_
, proto_tree
*tree _U_
, int hf_index _U_
) {
146 offset
= dissect_ber_bitstring(implicit_tag
, actx
, tree
, tvb
, offset
,
147 CertType_bits
, 8, hf_index
, ett_ns_cert_exts_CertType
,
155 static int dissect_BaseUrl_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
158 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
159 offset
= dissect_ns_cert_exts_BaseUrl(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_BaseUrl_PDU
);
162 static int dissect_RevocationUrl_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
165 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
166 offset
= dissect_ns_cert_exts_RevocationUrl(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_RevocationUrl_PDU
);
169 static int dissect_CaRevocationUrl_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
172 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
173 offset
= dissect_ns_cert_exts_CaRevocationUrl(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_CaRevocationUrl_PDU
);
176 static int dissect_CaPolicyUrl_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
179 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
180 offset
= dissect_ns_cert_exts_CaPolicyUrl(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_CaPolicyUrl_PDU
);
183 static int dissect_Comment_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
186 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
187 offset
= dissect_ns_cert_exts_Comment(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_Comment_PDU
);
190 static int dissect_SslServerName_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
193 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
194 offset
= dissect_ns_cert_exts_SslServerName(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_SslServerName_PDU
);
197 static int dissect_CertRenewalUrl_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
200 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
201 offset
= dissect_ns_cert_exts_CertRenewalUrl(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_CertRenewalUrl_PDU
);
204 static int dissect_CertType_PDU(tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
, proto_tree
*tree _U_
, void *data _U_
) {
207 asn1_ctx_init(&asn1_ctx
, ASN1_ENC_BER
, true, pinfo
);
208 offset
= dissect_ns_cert_exts_CertType(false, tvb
, offset
, &asn1_ctx
, tree
, hf_ns_cert_exts_CertType_PDU
);
214 /*--- proto_register_ns_cert_exts -------------------------------------------*/
215 void proto_register_ns_cert_exts(void) {
218 static hf_register_info hf
[] = {
219 { &hf_ns_cert_exts_BaseUrl_PDU
,
220 { "BaseUrl", "ns_cert_exts.BaseUrl",
221 FT_STRING
, BASE_NONE
, NULL
, 0,
223 { &hf_ns_cert_exts_RevocationUrl_PDU
,
224 { "RevocationUrl", "ns_cert_exts.RevocationUrl",
225 FT_STRING
, BASE_NONE
, NULL
, 0,
227 { &hf_ns_cert_exts_CaRevocationUrl_PDU
,
228 { "CaRevocationUrl", "ns_cert_exts.CaRevocationUrl",
229 FT_STRING
, BASE_NONE
, NULL
, 0,
231 { &hf_ns_cert_exts_CaPolicyUrl_PDU
,
232 { "CaPolicyUrl", "ns_cert_exts.CaPolicyUrl",
233 FT_STRING
, BASE_NONE
, NULL
, 0,
235 { &hf_ns_cert_exts_Comment_PDU
,
236 { "Comment", "ns_cert_exts.Comment",
237 FT_STRING
, BASE_NONE
, NULL
, 0,
239 { &hf_ns_cert_exts_SslServerName_PDU
,
240 { "SslServerName", "ns_cert_exts.SslServerName",
241 FT_STRING
, BASE_NONE
, NULL
, 0,
243 { &hf_ns_cert_exts_CertRenewalUrl_PDU
,
244 { "CertRenewalUrl", "ns_cert_exts.CertRenewalUrl",
245 FT_STRING
, BASE_NONE
, NULL
, 0,
247 { &hf_ns_cert_exts_CertType_PDU
,
248 { "CertType", "ns_cert_exts.CertType",
249 FT_BYTES
, BASE_NONE
, NULL
, 0,
251 { &hf_ns_cert_exts_CertType_ssl_client
,
252 { "ssl-client", "ns.cert.exts.CertType.ssl.client",
253 FT_BOOLEAN
, 8, NULL
, 0x80,
255 { &hf_ns_cert_exts_CertType_ssl_server
,
256 { "ssl-server", "ns.cert.exts.CertType.ssl.server",
257 FT_BOOLEAN
, 8, NULL
, 0x40,
259 { &hf_ns_cert_exts_CertType_smime
,
260 { "smime", "ns.cert.exts.CertType.smime",
261 FT_BOOLEAN
, 8, NULL
, 0x20,
263 { &hf_ns_cert_exts_CertType_object_signing
,
264 { "object-signing", "ns.cert.exts.CertType.object.signing",
265 FT_BOOLEAN
, 8, NULL
, 0x10,
267 { &hf_ns_cert_exts_CertType_reserved_for_future_use
,
268 { "reserved-for-future-use", "ns.cert.exts.CertType.reserved.for.future.use",
269 FT_BOOLEAN
, 8, NULL
, 0x08,
271 { &hf_ns_cert_exts_CertType_ssl_ca
,
272 { "ssl-ca", "ns.cert.exts.CertType.ssl.ca",
273 FT_BOOLEAN
, 8, NULL
, 0x04,
275 { &hf_ns_cert_exts_CertType_smime_ca
,
276 { "smime-ca", "ns.cert.exts.CertType.smime.ca",
277 FT_BOOLEAN
, 8, NULL
, 0x02,
279 { &hf_ns_cert_exts_CertType_object_signing_ca
,
280 { "object-signing-ca", "ns.cert.exts.CertType.object.signing.ca",
281 FT_BOOLEAN
, 8, NULL
, 0x01,
285 /* List of subtrees */
286 static int *ett
[] = {
287 &ett_ns_cert_exts_CertType
,
290 /* Register protocol */
291 proto_ns_cert_exts
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
293 /* Register fields and subtrees */
294 proto_register_field_array(proto_ns_cert_exts
, hf
, array_length(hf
));
295 proto_register_subtree_array(ett
, array_length(ett
));
300 /*--- proto_reg_handoff_ns_cert_exts ---------------------------------------*/
301 void proto_reg_handoff_ns_cert_exts(void) {
302 register_ber_oid_dissector("2.16.840.1.113730.1.1", dissect_CertType_PDU
, proto_ns_cert_exts
, "ns_cert_exts.cert_type");
303 register_ber_oid_dissector("2.16.840.1.113730.1.2", dissect_BaseUrl_PDU
, proto_ns_cert_exts
, "ns_cert_exts.base_url");
304 register_ber_oid_dissector("2.16.840.1.113730.1.3", dissect_RevocationUrl_PDU
, proto_ns_cert_exts
, "ns_cert_exts.revocation-url");
305 register_ber_oid_dissector("2.16.840.1.113730.1.4", dissect_CaRevocationUrl_PDU
, proto_ns_cert_exts
, "ns_cert_exts.ca-revocation-url");
306 register_ber_oid_dissector("2.16.840.1.113730.1.7", dissect_CertRenewalUrl_PDU
, proto_ns_cert_exts
, "ns_cert_exts.cert-renewal-url");
307 register_ber_oid_dissector("2.16.840.1.113730.1.8", dissect_CaPolicyUrl_PDU
, proto_ns_cert_exts
, "ns_cert_exts.ca-policy-url");
308 register_ber_oid_dissector("2.16.840.1.113730.1.12", dissect_SslServerName_PDU
, proto_ns_cert_exts
, "ns_cert_exts.ssl-server-name");
309 register_ber_oid_dissector("2.16.840.1.113730.1.13", dissect_Comment_PDU
, proto_ns_cert_exts
, "ns_cert_exts.comment");