New protocol: RFC2634 ExtendedSecurityServices
[obnox/wireshark/wip.git] / asn1 / x509af / packet-x509af-template.c
1 /* packet-x509af.c
2  * Routines for X.509 Authentication Framework packet dissection
3  *  Ronnie Sahlberg 2004
4  *
5  * $Id$
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <glib.h>
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
33
34 #include <stdio.h>
35 #include <string.h>
36
37 #include "packet-ber.h"
38 #include "packet-x509af.h"
39 #include "packet-x509ce.h"
40 #include "packet-x509if.h"
41 #include "packet-x509sat.h"
42
43 #define PNAME  "X.509 Authentication Framework"
44 #define PSNAME "X509AF"
45 #define PFNAME "x509af"
46
47 /* Initialize the protocol and registered fields */
48 static int proto_x509af = -1;
49 static int hf_x509af_algorithm_id = -1;
50 static int hf_x509af_extension_id = -1;
51 #include "packet-x509af-hf.c"
52
53 /* Initialize the subtree pointers */
54 #include "packet-x509af-ett.c"
55
56 static char algorithm_id[64]; /*64 chars should be long enough? */
57
58
59 static char extension_id[64]; /*64 chars should be long enough? */
60
61
62 #include "packet-x509af-fn.c"
63
64
65 /*--- proto_register_x509af ----------------------------------------------*/
66 void proto_register_x509af(void) {
67
68   /* List of fields */
69   static hf_register_info hf[] = {
70     { &hf_x509af_algorithm_id,
71       { "Algorithm Id", "x509af.algorithm.id",
72         FT_STRING, BASE_NONE, NULL, 0,
73         "Algorithm Id", HFILL }},
74     { &hf_x509af_extension_id,
75       { "Extension Id", "x509af.extension.id",
76         FT_STRING, BASE_NONE, NULL, 0,
77         "Extension Id", HFILL }},
78 #include "packet-x509af-hfarr.c"
79   };
80
81   /* List of subtrees */
82   static gint *ett[] = {
83 #include "packet-x509af-ettarr.c"
84   };
85
86   /* Register protocol */
87   proto_x509af = proto_register_protocol(PNAME, PSNAME, PFNAME);
88
89   /* Register fields and subtrees */
90   proto_register_field_array(proto_x509af, hf, array_length(hf));
91   proto_register_subtree_array(ett, array_length(ett));
92
93 }
94
95
96 /*--- proto_reg_handoff_x509af -------------------------------------------*/
97 void proto_reg_handoff_x509af(void) {
98 #include "packet-x509af-dis-tab.c"
99
100         /*XXX these should really go to a better place but since that
101           I have not that ITU standard, ill put it here for the time
102           being.
103           Only implemented those algorithms that take no parameters 
104           for the time being,   ronnie
105         */
106         /* from http://www.alvestrand.no/objectid/1.3.14.3.2.html */
107         register_ber_oid_dissector("1.3.14.3.2.2", dissect_ber_oid_NULL_callback, proto_x509af, "md4WithRSA");
108         register_ber_oid_dissector("1.3.14.3.2.3", dissect_ber_oid_NULL_callback, proto_x509af, "md5WithRSA");
109         register_ber_oid_dissector("1.3.14.3.2.4", dissect_ber_oid_NULL_callback, proto_x509af, "md4WithRSAEncryption");
110         register_ber_oid_dissector("1.3.14.3.2.6", dissect_ber_oid_NULL_callback, proto_x509af, "desECB");
111         register_ber_oid_dissector("1.3.14.3.2.11", dissect_ber_oid_NULL_callback, proto_x509af, "rsaSignature");
112         register_ber_oid_dissector("1.3.14.3.2.14", dissect_ber_oid_NULL_callback, proto_x509af, "mdc2WithRSASignature");
113         register_ber_oid_dissector("1.3.14.3.2.15", dissect_ber_oid_NULL_callback, proto_x509af, "shaWithRSASignature");
114         register_ber_oid_dissector("1.3.14.3.2.16", dissect_ber_oid_NULL_callback, proto_x509af, "dhWithCommonModulus");
115         register_ber_oid_dissector("1.3.14.3.2.17", dissect_ber_oid_NULL_callback, proto_x509af, "desEDE");
116         register_ber_oid_dissector("1.3.14.3.2.18", dissect_ber_oid_NULL_callback, proto_x509af, "sha");
117         register_ber_oid_dissector("1.3.14.3.2.19", dissect_ber_oid_NULL_callback, proto_x509af, "mdc-2");
118         register_ber_oid_dissector("1.3.14.3.2.20", dissect_ber_oid_NULL_callback, proto_x509af, "dsaCommon");
119         register_ber_oid_dissector("1.3.14.3.2.21", dissect_ber_oid_NULL_callback, proto_x509af, "dsaCommonWithSHA");
120         register_ber_oid_dissector("1.3.14.3.2.22", dissect_ber_oid_NULL_callback, proto_x509af, "rsaKeyTransport");
121         register_ber_oid_dissector("1.3.14.3.2.23", dissect_ber_oid_NULL_callback, proto_x509af, "keyed-hash-seal");
122         register_ber_oid_dissector("1.3.14.3.2.24", dissect_ber_oid_NULL_callback, proto_x509af, "md2WithRSASignature");
123         register_ber_oid_dissector("1.3.14.3.2.25", dissect_ber_oid_NULL_callback, proto_x509af, "md5WithRSASignature");
124         register_ber_oid_dissector("1.3.14.3.2.26", dissect_ber_oid_NULL_callback, proto_x509af, "SHA-1");
125 }
126