3 * Routines to dissect WTLS component of WAP traffic.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * WAP dissector based on original work by Ben Fowler
12 * Updated by Neil Hunter <neil.hunter@energis-squared.com>
13 * WTLS support by Alexandre P. Ferreira (Splice IP)
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
38 #include <epan/packet.h>
39 #include "packet-wap.h"
40 #include "packet-wtls.h"
42 /* File scoped variables for the protocol and registered fields */
43 static int proto_wtls
= HF_EMPTY
;
45 /* These fields used by fixed part of header */
46 static int hf_wtls_record
= HF_EMPTY
;
47 static int hf_wtls_record_type
= HF_EMPTY
;
48 static int hf_wtls_record_length
= HF_EMPTY
;
49 static int hf_wtls_record_sequence
= HF_EMPTY
;
50 static int hf_wtls_record_ciphered
= HF_EMPTY
;
51 static int hf_wtls_hands
= HF_EMPTY
;
52 static int hf_wtls_hands_type
= HF_EMPTY
;
53 static int hf_wtls_hands_length
= HF_EMPTY
;
54 static int hf_wtls_hands_cli_hello
= HF_EMPTY
;
55 static int hf_wtls_hands_cli_hello_version
= HF_EMPTY
;
56 static int hf_wtls_hands_cli_hello_gmt
= HF_EMPTY
;
57 static int hf_wtls_hands_cli_hello_random
= HF_EMPTY
;
58 static int hf_wtls_hands_cli_hello_session
= HF_EMPTY
;
59 static int hf_wtls_hands_cli_hello_session_str
= HF_EMPTY
;
60 static int hf_wtls_hands_cli_hello_cli_key_id
= HF_EMPTY
;
61 static int hf_wtls_hands_cli_hello_cli_key_len
= HF_EMPTY
;
62 static int hf_wtls_hands_cli_hello_trust_key_id
= HF_EMPTY
;
63 static int hf_wtls_hands_cli_hello_key_exchange
= HF_EMPTY
;
64 static int hf_wtls_hands_cli_hello_key_exchange_suite
= HF_EMPTY
;
65 static int hf_wtls_hands_cli_hello_key_parameter_index
= HF_EMPTY
;
66 static int hf_wtls_hands_cli_hello_key_parameter_set
= HF_EMPTY
;
67 static int hf_wtls_hands_cli_hello_key_identifier_type
= HF_EMPTY
;
68 static int hf_wtls_hands_cli_hello_key_identifier_charset
= HF_EMPTY
;
69 static int hf_wtls_hands_cli_hello_key_identifier_size
= HF_EMPTY
;
70 static int hf_wtls_hands_cli_hello_key_identifier
= HF_EMPTY
;
71 static int hf_wtls_hands_cli_hello_key_identifier_str
= HF_EMPTY
;
72 static int hf_wtls_hands_cli_hello_cipher_suite
= HF_EMPTY
;
73 static int hf_wtls_hands_cli_hello_cipher_suite_item
= HF_EMPTY
;
74 static int hf_wtls_hands_cli_hello_compression_methods
= HF_EMPTY
;
75 static int hf_wtls_hands_cli_hello_compression
= HF_EMPTY
;
76 static int hf_wtls_hands_cli_hello_sequence_mode
= HF_EMPTY
;
77 static int hf_wtls_hands_cli_hello_key_refresh
= HF_EMPTY
;
78 static int hf_wtls_hands_serv_hello
= HF_EMPTY
;
79 static int hf_wtls_hands_serv_hello_version
= HF_EMPTY
;
80 static int hf_wtls_hands_serv_hello_gmt
= HF_EMPTY
;
81 static int hf_wtls_hands_serv_hello_random
= HF_EMPTY
;
82 static int hf_wtls_hands_serv_hello_session
= HF_EMPTY
;
83 static int hf_wtls_hands_serv_hello_session_str
= HF_EMPTY
;
84 static int hf_wtls_hands_serv_hello_cli_key_id
= HF_EMPTY
;
85 static int hf_wtls_hands_serv_hello_cipher_suite_item
= HF_EMPTY
;
86 static int hf_wtls_hands_serv_hello_cipher_bulk
= HF_EMPTY
;
87 static int hf_wtls_hands_serv_hello_cipher_mac
= HF_EMPTY
;
88 static int hf_wtls_hands_serv_hello_compression
= HF_EMPTY
;
89 static int hf_wtls_hands_serv_hello_sequence_mode
= HF_EMPTY
;
90 static int hf_wtls_hands_serv_hello_key_refresh
= HF_EMPTY
;
91 static int hf_wtls_hands_certificates
= HF_EMPTY
;
92 static int hf_wtls_hands_certificate
= HF_EMPTY
;
93 static int hf_wtls_hands_certificate_type
= HF_EMPTY
;
94 static int hf_wtls_hands_certificate_wtls_version
= HF_EMPTY
;
95 static int hf_wtls_hands_certificate_wtls_signature_type
= HF_EMPTY
;
96 static int hf_wtls_hands_certificate_wtls_issuer_type
= HF_EMPTY
;
97 static int hf_wtls_hands_certificate_wtls_issuer_charset
= HF_EMPTY
;
98 static int hf_wtls_hands_certificate_wtls_issuer_size
= HF_EMPTY
;
99 static int hf_wtls_hands_certificate_wtls_issuer_name
= HF_EMPTY
;
100 static int hf_wtls_hands_certificate_wtls_valid_not_before
= HF_EMPTY
;
101 static int hf_wtls_hands_certificate_wtls_valid_not_after
= HF_EMPTY
;
102 static int hf_wtls_hands_certificate_wtls_subject_type
= HF_EMPTY
;
103 static int hf_wtls_hands_certificate_wtls_subject_charset
= HF_EMPTY
;
104 static int hf_wtls_hands_certificate_wtls_subject_size
= HF_EMPTY
;
105 static int hf_wtls_hands_certificate_wtls_subject_name
= HF_EMPTY
;
106 static int hf_wtls_hands_certificate_wtls_public_key_type
= HF_EMPTY
;
107 static int hf_wtls_hands_certificate_wtls_key_parameter_index
= HF_EMPTY
;
108 static int hf_wtls_hands_certificate_wtls_key_parameter_set
= HF_EMPTY
;
109 static int hf_wtls_hands_certificate_wtls_rsa_exponent
= HF_EMPTY
;
110 static int hf_wtls_hands_certificate_wtls_rsa_modules
= HF_EMPTY
;
111 static int hf_wtls_hands_certificate_wtls_signature
= HF_EMPTY
;
112 static int hf_wtls_alert
= HF_EMPTY
;
113 static int hf_wtls_alert_level
= HF_EMPTY
;
114 static int hf_wtls_alert_description
= HF_EMPTY
;
116 /* Initialize the subtree pointers */
117 static gint ett_wtls
= ETT_EMPTY
;
118 static gint ett_wtls_rec
= ETT_EMPTY
;
119 static gint ett_wtls_msg_type
= ETT_EMPTY
;
120 static gint ett_wtls_msg_type_item
= ETT_EMPTY
;
121 static gint ett_wtls_msg_type_item_sub
= ETT_EMPTY
;
122 static gint ett_wtls_msg_type_item_sub_sub
= ETT_EMPTY
;
124 static const value_string wtls_vals_record_type
[] = {
125 { 1, "change_cipher_data" },
128 { 4, "application_data" },
131 static value_string_ext wtls_vals_record_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_record_type
);
133 static const value_string wtls_vals_cipher_bulk
[] = {
140 { 6, "3DES CBC cwEDE40" },
141 { 7, "IDEA CBC 40" },
142 { 8, "IDEA CBC 56" },
146 static value_string_ext wtls_vals_cipher_bulk_ext
= VALUE_STRING_EXT_INIT(wtls_vals_cipher_bulk
);
148 static const value_string wtls_vals_cipher_mac
[] = {
159 static value_string_ext wtls_vals_cipher_mac_ext
= VALUE_STRING_EXT_INIT(wtls_vals_cipher_mac
);
161 static const value_string wtls_vals_handshake_type
[] = {
162 { 0, "Hello Request" },
163 { 1, "Client Hello" },
164 { 2, "Server Hello" },
165 { 11, "Certificate" },
166 { 12, "Server Key Exchange" },
167 { 13, "Certificate Request" },
168 { 14, "Server Hello Done" },
169 { 15, "Certificate Verify" },
170 { 16, "Client Key Exchange" },
174 static value_string_ext wtls_vals_handshake_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_handshake_type
);
176 static const value_string wtls_vals_key_exchange_suite
[] = {
178 { 1, "Shared Secret" },
179 { 2, "Diffie Hellman Anonymous" },
180 { 3, "Diffie Hellman Anonymous 512" },
181 { 4, "Diffie Hellman Anonymous 768" },
182 { 5, "RSA Anonymous" },
183 { 6, "RSA Anonymous 512" },
184 { 7, "RSA Anonymous 768" },
188 { 11, "EC Diffie Hellman Anonymous" },
189 { 12, "EC Diffie Hellman Anonymous 113" },
190 { 13, "EC Diffie Hellman Anonymous 131" },
191 { 14, "EC Diffie Hellman ECDSA" },
192 { 15, "EC Diffie Hellman Anonymous Uncomp" },
193 { 16, "EC Diffie Hellman Anonymous Uncomp 113" },
194 { 17, "EC Diffie Hellman Anonymous Uncomp 131" },
195 { 18, "EC Diffie Hellman ECDSA Uncomp" },
198 static value_string_ext wtls_vals_key_exchange_suite_ext
= VALUE_STRING_EXT_INIT(wtls_vals_key_exchange_suite
);
200 static const value_string wtls_vals_identifier_type
[] = {
201 { 0, "No identifier" },
202 { 1, "Textual Name" },
203 { 2, "Binary Name" },
204 { 254, "SHA-1 Hash of Public Key" },
205 { 255, "x509 Distinguished Name" },
208 static value_string_ext wtls_vals_identifier_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_identifier_type
);
210 static const value_string wtls_vals_certificate_type
[] = {
217 static value_string_ext wtls_vals_certificate_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_certificate_type
);
219 static const value_string wtls_vals_compression
[] = {
224 static const value_string wtls_vals_sequence_mode
[] = {
231 static const value_string wtls_vals_certificate_signature
[] = {
238 static const value_string wtls_vals_public_key_type
[] = {
245 static const value_string wtls_vals_alert_level
[] = {
252 static const value_string wtls_vals_alert_description
[] = {
253 { 0, "connection_close_notify"},
254 { 1, "session_close_notify"},
255 { 5, "no_connection"},
256 { 10, "unexpected_message"},
257 { 11, "time_required"},
258 { 20, "bad_record_mac"},
259 { 21, "decryption_failed"},
260 { 22, "record_overflow"},
261 { 30, "decompression_failure"},
262 { 40, "handshake_failure"},
263 { 42, "bad_certificate"},
264 { 43, "unsupported_certificate"},
265 { 44, "certificate_revoked"},
266 { 45, "certificate_expired"},
267 { 46, "certificate_unknown"},
268 { 47, "illegal_parameter"},
270 { 49, "access_denied"},
271 { 50, "decode_error"},
272 { 51, "decrypt_error"},
273 { 52, "unknown_key_id"},
274 { 53, "disabled_key_id"},
275 { 54, "key_exchange_disabled"},
276 { 55, "session_not_ready"},
277 { 56, "unknown_parameter_index"},
278 { 57, "duplicate_finished_received"},
279 { 60, "export_restriction"},
280 { 70, "protocol_version"},
281 { 71, "insufficient_security"},
282 { 80, "internal_error"},
283 { 90, "user_canceled"},
284 { 100, "no_renegotiation"},
287 static value_string_ext wtls_vals_alert_description_ext
= VALUE_STRING_EXT_INIT(wtls_vals_alert_description
);
289 #define WTLS_RECORD_TYPE_LENGTH 0x80
290 #define WTLS_RECORD_TYPE_SEQUENCE 0x40
291 #define WTLS_RECORD_TYPE_CIPHER_CUR 0x20
292 #define WTLS_RECORD_CONTENT_TYPE 0x0f
294 #define WTLS_ALERT 0x02
295 #define WTLS_PLAIN_HANDSHAKE 0x03
297 #define WTLS_HANDSHAKE_CLIENT_HELLO 1
298 #define WTLS_HANDSHAKE_SERVER_HELLO 2
299 #define WTLS_HANDSHAKE_CERTIFICATE 11
301 #define CERTIFICATE_WTLS 1
302 #define CERTIFICATE_X509 2
303 #define CERTIFICATE_X968 3
304 #define CERTIFICATE_URL 4
306 #define IDENTIFIER_NULL 0
307 #define IDENTIFIER_TEXT 1
308 #define IDENTIFIER_BIN 2
309 #define IDENTIFIER_SHA_1 254
310 #define IDENTIFIER_X509 255
312 #define PUBLIC_KEY_RSA 2
313 #define PUBLIC_KEY_ECDH 3
314 #define PUBLIC_KEY_ECDSA 4
316 static void dissect_wtls_handshake (proto_tree
*, tvbuff_t
*, guint
, guint
);
318 /* Code to actually dissect the packets */
320 dissect_wtls(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
326 guint offset_wtls
= 0;
328 /* Set up structures we will need to add the protocol subtree and manage it */
330 proto_tree
*wtls_tree
;
331 proto_tree
*wtls_rec_tree
;
332 proto_tree
*wtls_msg_type_tree
;
334 switch ( pinfo
->match_uint
)
336 case UDP_PORT_WTLS_WSP
:
337 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "WTLS+WSP" );
339 case UDP_PORT_WTLS_WTP_WSP
:
340 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "WTLS+WTP+WSP" );
344 /* Develop the string to put in the Info column */
345 col_set_str(pinfo
->cinfo
, COL_INFO
, "WTLS");
347 /* In the interest of speed, if "tree" is NULL, don't do any work not
348 necessary to generate protocol tree items. */
351 ti
= proto_tree_add_item(tree
, proto_wtls
, tvb
, offset_wtls
,
353 wtls_tree
= proto_item_add_subtree(ti
, ett_wtls
);
355 for (offset_wtls
=0; offset_wtls
< (tvb_reported_length(tvb
)-1);) {
356 pdut
= tvb_get_guint8 (tvb
, offset_wtls
);
358 offset
= offset_wtls
+1;
360 if (pdut
& WTLS_RECORD_TYPE_SEQUENCE
) {
363 if (pdut
& WTLS_RECORD_TYPE_LENGTH
) {
364 count
= tvb_get_ntohs(tvb
, offset
);
366 count
+= offset
-offset_wtls
;
369 count
= tvb_length_remaining (tvb
, offset_wtls
);
371 ti
= proto_tree_add_uint(wtls_tree
, hf_wtls_record
, tvb
, offset_wtls
,
373 wtls_rec_tree
= proto_item_add_subtree(ti
, ett_wtls_rec
);
375 offset
= offset_wtls
;
377 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_type
,
378 tvb
,offset
,1,ENC_BIG_ENDIAN
);
382 offset_wtls
+= count
;
384 if (pdut
& WTLS_RECORD_TYPE_SEQUENCE
) {
385 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_sequence
,
386 tvb
,offset
,2,ENC_BIG_ENDIAN
);
389 if (pdut
& WTLS_RECORD_TYPE_LENGTH
) {
390 count
= tvb_get_ntohs(tvb
, offset
);
391 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_length
,
392 tvb
,offset
,2,ENC_BIG_ENDIAN
);
396 count
= tvb_length_remaining (tvb
, offset
);
399 if (pdut
& WTLS_RECORD_TYPE_CIPHER_CUR
) {
400 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_ciphered
,
401 tvb
,offset
,count
,ENC_NA
);
405 switch (pdut
& WTLS_RECORD_CONTENT_TYPE
) {
406 case WTLS_PLAIN_HANDSHAKE
:
407 dissect_wtls_handshake(wtls_rec_tree
,tvb
,offset
,count
);
410 ti
= proto_tree_add_item(wtls_rec_tree
, hf_wtls_alert
, tvb
, offset
,
412 wtls_msg_type_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type
);
413 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_alert_level
,
414 tvb
,offset
,1,ENC_BIG_ENDIAN
);
416 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_alert_description
,
417 tvb
,offset
,1,ENC_BIG_ENDIAN
);
429 add_text_identifier(tvbuff_t
*tvb
, int offset
, int hf_charset
,
430 int hf_size
, int hf_str
, proto_tree
*tree
)
435 proto_tree_add_item(tree
, hf_charset
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
437 size
= tvb_get_guint8 (tvb
, offset
);
438 proto_tree_add_item(tree
, hf_size
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
440 proto_tree_add_item(tree
, hf_str
, tvb
, offset
, size
, ENC_BIG_ENDIAN
);
444 fprintf(stderr
, "text id size = %d, client_size = %d\n",
451 add_session_id(proto_tree
*tree
, int hf
, int hf_str
, tvbuff_t
*tvb
, int offset
)
456 header_field_info
*hfinfo
;
458 count
= tvb_get_guint8(tvb
, offset
);
460 proto_tree_add_string (tree
, hf_str
, tvb
, offset
, count
+1, "NULL");
461 else if (count
<= 8) {
463 for (i
= 0; i
< count
; i
++)
464 session_id
= (session_id
<< 8) | tvb_get_guint8(tvb
, offset
+ i
);
465 proto_tree_add_uint64 (tree
, hf
, tvb
, offset
, count
+1, session_id
);
467 hfinfo
= proto_registrar_get_nth(hf
);
468 proto_tree_add_text (tree
, tvb
, offset
, count
+1, "%s: %s",
469 hfinfo
->name
, tvb_bytes_to_str(tvb
, offset
+1, count
));
471 return offset
+1+count
;
475 dissect_wtls_handshake(proto_tree
*tree
, tvbuff_t
*tvb
, guint offset
, guint count
)
482 guint public_key
= 0;
484 const char *valBulk
= NULL
;
485 const char *valMac
= NULL
;
488 proto_item
*cli_key_item
;
489 proto_tree
*wtls_msg_type_tree
;
490 proto_tree
*wtls_msg_type_item_tree
;
491 proto_tree
*wtls_msg_type_item_sub_tree
;
492 proto_tree
*wtls_msg_type_item_sub_sub_tree
;
494 pdu_msg_type
= tvb_get_guint8 (tvb
, offset
);
495 ti
= proto_tree_add_uint(tree
, hf_wtls_hands
, tvb
, offset
,count
, pdu_msg_type
);
496 wtls_msg_type_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type
);
498 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_hands_type
,
499 tvb
,offset
,1,ENC_BIG_ENDIAN
);
501 count
= tvb_get_ntohs (tvb
, offset
);
502 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_hands_length
,
503 tvb
,offset
,2,ENC_BIG_ENDIAN
);
505 switch(pdu_msg_type
) {
506 case WTLS_HANDSHAKE_CLIENT_HELLO
:
507 ti
= proto_tree_add_item(wtls_msg_type_tree
, hf_wtls_hands_cli_hello
, tvb
, offset
,
509 wtls_msg_type_item_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item
);
510 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_cli_hello_version
,
511 tvb
,offset
,1,ENC_BIG_ENDIAN
);
513 timeValue
.secs
= tvb_get_ntohl (tvb
, offset
);
515 proto_tree_add_time (wtls_msg_type_item_tree
, hf_wtls_hands_cli_hello_gmt
, tvb
,
516 offset
, 4, &timeValue
);
518 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_cli_hello_random
,
519 tvb
,offset
,12,ENC_NA
);
521 offset
= add_session_id (wtls_msg_type_item_tree
,
522 hf_wtls_hands_cli_hello_session
,
523 hf_wtls_hands_cli_hello_session_str
,
526 /* process client_key_ids structure */
527 count
= tvb_get_ntohs (tvb
, offset
);
528 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
529 hf_wtls_hands_cli_hello_cli_key_id
, tvb
, offset
,
531 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
533 /* display length of client_key_ids structure */
534 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
535 hf_wtls_hands_cli_hello_cli_key_len
,
536 tvb
,offset
,2,ENC_BIG_ENDIAN
);
539 /* cycle through client_key_ids entries */
540 for (;count
> 0;count
-=client_size
) {
541 /* get encryption suite id (one byte) */
542 value
= tvb_get_guint8 (tvb
, offset
);
543 cli_key_item
= proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
544 hf_wtls_hands_cli_hello_key_exchange
, tvb
, offset
,1,
547 wtls_msg_type_item_sub_sub_tree
= proto_item_add_subtree(cli_key_item
,
548 ett_wtls_msg_type_item_sub_sub
);
549 proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree
,
550 hf_wtls_hands_cli_hello_key_exchange_suite
,
554 fprintf(stderr
, "encryption suite = %d, client_size = %d\n", value
, client_size
);
557 /* get parameter index (one byte) */
558 value
= tvb_get_guint8 (tvb
, offset
);
559 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
560 hf_wtls_hands_cli_hello_key_parameter_index
,
561 tvb
,offset
,1,ENC_BIG_ENDIAN
);
565 fprintf(stderr
, "parameter index = %d, client_size = %d\n", value
, client_size
);
568 /* explicit parameters present in next field */
570 size
= tvb_get_ntohs (tvb
, offset
);
571 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
572 hf_wtls_hands_cli_hello_key_parameter_set
,
573 tvb
,offset
,size
+2,ENC_ASCII
|ENC_NA
);
578 /* get identifier type */
579 value
= tvb_get_guint8 (tvb
, offset
);
580 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
581 hf_wtls_hands_cli_hello_key_identifier_type
,
582 tvb
,offset
,1,ENC_BIG_ENDIAN
);
586 fprintf(stderr
, "identifier type = %d, client_size = %d\n", value
, client_size
);
589 /* identifier present in next field */
590 /* note: value 0x0 means no identifier */
592 case IDENTIFIER_TEXT
:
593 /* text identifier */
595 size
= add_text_identifier(
597 hf_wtls_hands_cli_hello_key_identifier_charset
,
598 hf_wtls_hands_cli_hello_key_identifier_size
,
599 hf_wtls_hands_cli_hello_key_identifier_str
,
600 wtls_msg_type_item_sub_sub_tree
);
604 case IDENTIFIER_BIN
:
605 /* binary identifier */
606 size
= tvb_get_guint8 (tvb
, offset
);
607 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
608 hf_wtls_hands_cli_hello_key_identifier_size
,
609 tvb
,offset
,1,ENC_BIG_ENDIAN
);
611 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
612 hf_wtls_hands_cli_hello_key_identifier
,
613 tvb
,offset
,size
,ENC_NA
);
617 fprintf(stderr
, "binary id size = %d, client_size = %d\n",
621 case IDENTIFIER_SHA_1
:
622 /* SHA-1 hash of the public key */
623 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
624 hf_wtls_hands_cli_hello_key_identifier
,
625 tvb
,offset
,20,ENC_NA
);
629 fprintf(stderr
, "SHA-1 hash size = 20, client_size = %d\n",
633 case IDENTIFIER_X509
:
634 /* X.509 distinguished name */
636 size
= tvb_get_guint8 (tvb
, offset
);
637 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
638 hf_wtls_hands_cli_hello_key_identifier_size
,
639 tvb
,offset
,1,ENC_BIG_ENDIAN
);
641 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
642 hf_wtls_hands_cli_hello_key_identifier
,
643 tvb
,offset
,size
,ENC_NA
);
647 fprintf(stderr
, "X.509 name size = %d, client_size = %d\n",
653 proto_item_set_len(cli_key_item
, client_size
);
656 /* process trusted_keys structure */
657 count
= tvb_get_ntohs (tvb
, offset
);
658 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
659 hf_wtls_hands_cli_hello_trust_key_id
, tvb
, offset
,
661 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
663 /* display length of trusted_keys structure */
664 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
665 hf_wtls_hands_cli_hello_cli_key_len
,
666 tvb
,offset
,2,ENC_BIG_ENDIAN
);
669 for (;count
> 0;count
-=client_size
) {
670 /* get encryption suite id (one byte) */
671 value
= tvb_get_guint8 (tvb
, offset
);
672 cli_key_item
= proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
673 hf_wtls_hands_cli_hello_key_exchange
, tvb
, offset
,1,
676 wtls_msg_type_item_sub_sub_tree
= proto_item_add_subtree(cli_key_item
,
677 ett_wtls_msg_type_item_sub_sub
);
678 proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree
,
679 hf_wtls_hands_cli_hello_key_exchange_suite
,
683 fprintf(stderr
, "encryption suite = %d, client_size = %d\n", value
, client_size
);
686 /* get parameter index (one byte) */
687 value
= tvb_get_guint8 (tvb
, offset
);
688 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
689 hf_wtls_hands_cli_hello_key_parameter_index
,
690 tvb
,offset
,1,ENC_BIG_ENDIAN
);
694 fprintf(stderr
, "parameter index = %d, client_size = %d\n", value
, client_size
);
697 /* explicit parameters present in next field */
699 size
= tvb_get_ntohs (tvb
, offset
);
700 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
701 hf_wtls_hands_cli_hello_key_parameter_set
,
702 tvb
,offset
,size
+2,ENC_ASCII
|ENC_NA
);
707 /* get identifier type */
708 value
= tvb_get_guint8 (tvb
, offset
);
709 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
710 hf_wtls_hands_cli_hello_key_identifier_type
,
711 tvb
,offset
,1,ENC_BIG_ENDIAN
);
715 fprintf(stderr
, "identifier type = %d, client_size = %d\n", value
, client_size
);
718 /* identifier present in next field */
719 /* note: value 0x0 means no identifier */
721 case IDENTIFIER_TEXT
:
722 /* text identifier */
724 size
= add_text_identifier(
726 hf_wtls_hands_cli_hello_key_identifier_charset
,
727 hf_wtls_hands_cli_hello_key_identifier_size
,
728 hf_wtls_hands_cli_hello_key_identifier_str
,
729 wtls_msg_type_item_sub_sub_tree
);
733 case IDENTIFIER_BIN
:
734 /* binary identifier */
735 size
= tvb_get_guint8 (tvb
, offset
);
736 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
737 hf_wtls_hands_cli_hello_key_identifier_size
,
738 tvb
,offset
,1,ENC_BIG_ENDIAN
);
740 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
741 hf_wtls_hands_cli_hello_key_identifier
,
742 tvb
,offset
,size
,ENC_NA
);
746 fprintf(stderr
, "binary id size = %d, client_size = %d\n",
750 case IDENTIFIER_SHA_1
:
751 /* SHA-1 hash of the public key */
752 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
753 hf_wtls_hands_cli_hello_key_identifier
,
754 tvb
,offset
,20,ENC_NA
);
758 fprintf(stderr
, "SHA-1 hash size = 20, client_size = %d\n",
762 case IDENTIFIER_X509
:
763 /* X.509 distinguished name */
765 size
= tvb_get_guint8 (tvb
, offset
);
766 /* need to fetch identifier and display it */
767 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
768 hf_wtls_hands_cli_hello_key_identifier_size
,
769 tvb
,offset
,1,ENC_BIG_ENDIAN
);
771 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
772 hf_wtls_hands_cli_hello_key_identifier
,
773 tvb
,offset
,size
,ENC_NA
);
777 fprintf(stderr
, "X.509 name size = %d, client_size = %d\n",
782 proto_item_set_len(cli_key_item
, client_size
);
785 /* process cipher_suites structure */
786 count
= tvb_get_guint8 (tvb
, offset
);
787 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
788 hf_wtls_hands_cli_hello_cipher_suite
, tvb
, offset
,
790 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
792 for (;count
> 0;count
-=client_size
) {
793 value
= tvb_get_guint8 (tvb
, offset
);
794 valBulk
= try_val_to_str_ext(value
, &wtls_vals_cipher_bulk_ext
);
797 valMac
= try_val_to_str_ext(tvb_get_guint8 (tvb
, offset
), &wtls_vals_cipher_mac_ext
);
802 g_snprintf(valStr
,1024,"%s, %s",valBulk
,valMac
);
806 g_snprintf(valStr
,1024,"%s, Unknown MAC (0x%02x)",valBulk
,tvb_get_guint8 (tvb
, offset
));
813 g_snprintf(valStr
,1024,"Unknown Bulk (0x%02x), %s",value
,valMac
);
817 g_snprintf(valStr
,1024,"Unknown Bulk (0x%02x), Unknown MAC (0x%02x)",value
,
818 tvb_get_guint8 (tvb
, offset
));
823 proto_tree_add_string(wtls_msg_type_item_sub_tree
,
824 hf_wtls_hands_cli_hello_cipher_suite_item
, tvb
, offset
-2,2,
827 count
= tvb_get_guint8 (tvb
, offset
);
828 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
829 hf_wtls_hands_cli_hello_compression_methods
, tvb
, offset
,
831 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
833 for (;count
> 0;count
-=client_size
) {
835 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
836 hf_wtls_hands_cli_hello_compression
, tvb
, offset
,1,
841 proto_tree_add_item(wtls_msg_type_item_tree
,
842 hf_wtls_hands_cli_hello_sequence_mode
, tvb
, offset
,
843 1, ENC_LITTLE_ENDIAN
);
845 proto_tree_add_item(wtls_msg_type_item_tree
,
846 hf_wtls_hands_cli_hello_key_refresh
, tvb
, offset
,
847 1, ENC_LITTLE_ENDIAN
);
849 case WTLS_HANDSHAKE_SERVER_HELLO
:
850 ti
= proto_tree_add_item(wtls_msg_type_tree
, hf_wtls_hands_serv_hello
, tvb
, offset
,
852 wtls_msg_type_item_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item
);
853 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_serv_hello_version
,
854 tvb
,offset
,1,ENC_BIG_ENDIAN
);
856 timeValue
.secs
= tvb_get_ntohl (tvb
, offset
);
858 proto_tree_add_time (wtls_msg_type_item_tree
, hf_wtls_hands_serv_hello_gmt
, tvb
,
859 offset
, 4, &timeValue
);
861 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_serv_hello_random
,
862 tvb
,offset
,12,ENC_NA
);
864 offset
= add_session_id (wtls_msg_type_item_tree
,
865 hf_wtls_hands_serv_hello_session
,
866 hf_wtls_hands_serv_hello_session_str
,
868 proto_tree_add_item(wtls_msg_type_item_tree
,
869 hf_wtls_hands_serv_hello_cli_key_id
,
870 tvb
,offset
,1,ENC_BIG_ENDIAN
);
872 cli_key_item
= proto_tree_add_item(wtls_msg_type_item_tree
,
873 hf_wtls_hands_serv_hello_cipher_suite_item
, tvb
, offset
,2,
875 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(cli_key_item
,
876 ett_wtls_msg_type_item_sub
);
877 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
878 hf_wtls_hands_serv_hello_cipher_bulk
,
879 tvb
,offset
,1,ENC_BIG_ENDIAN
);
881 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
882 hf_wtls_hands_serv_hello_cipher_mac
,
883 tvb
,offset
,1,ENC_BIG_ENDIAN
);
885 proto_tree_add_item(wtls_msg_type_item_tree
,
886 hf_wtls_hands_serv_hello_compression
, tvb
, offset
,1,
889 proto_tree_add_item(wtls_msg_type_item_tree
,
890 hf_wtls_hands_serv_hello_sequence_mode
, tvb
, offset
,
891 1, ENC_LITTLE_ENDIAN
);
893 proto_tree_add_item(wtls_msg_type_item_tree
,
894 hf_wtls_hands_serv_hello_key_refresh
, tvb
, offset
,
895 1, ENC_LITTLE_ENDIAN
);
898 case WTLS_HANDSHAKE_CERTIFICATE
:
899 ti
= proto_tree_add_item(wtls_msg_type_tree
, hf_wtls_hands_certificates
,
900 tvb
, offset
,count
, ENC_NA
);
901 wtls_msg_type_item_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item
);
902 count
= tvb_get_ntohs (tvb
, offset
);
904 for (;count
> 0;count
-=client_size
) {
905 cli_key_item
= proto_tree_add_item(wtls_msg_type_item_tree
,
906 hf_wtls_hands_certificate
, tvb
, offset
,1,
909 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(cli_key_item
,
910 ett_wtls_msg_type_item_sub
);
911 proto_item_set_len(cli_key_item
, client_size
);
912 value
= tvb_get_guint8 (tvb
, offset
);
913 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
914 hf_wtls_hands_certificate_type
, tvb
, offset
,1,
919 case CERTIFICATE_WTLS
:
920 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
921 hf_wtls_hands_certificate_wtls_version
,
926 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
927 hf_wtls_hands_certificate_wtls_signature_type
,
932 value
= tvb_get_guint8 (tvb
, offset
);
933 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
934 hf_wtls_hands_certificate_wtls_issuer_type
,
940 case IDENTIFIER_NULL
:
942 case IDENTIFIER_TEXT
:
943 value
= add_text_identifier(tvb
, offset
,
944 hf_wtls_hands_certificate_wtls_issuer_charset
,
945 hf_wtls_hands_certificate_wtls_issuer_size
,
946 hf_wtls_hands_certificate_wtls_issuer_name
,
947 wtls_msg_type_item_sub_tree
);
949 client_size
+= value
;
951 case IDENTIFIER_BIN
:
953 case IDENTIFIER_SHA_1
:
955 case IDENTIFIER_X509
:
958 timeValue
.secs
= tvb_get_ntohl (tvb
, offset
);
960 proto_tree_add_time (wtls_msg_type_item_sub_tree
,
961 hf_wtls_hands_certificate_wtls_valid_not_before
,
962 tvb
, offset
, 4, &timeValue
);
965 timeValue
.secs
= tvb_get_ntohl (tvb
, offset
);
967 proto_tree_add_time (wtls_msg_type_item_sub_tree
,
968 hf_wtls_hands_certificate_wtls_valid_not_after
,
969 tvb
, offset
, 4, &timeValue
);
972 value
= tvb_get_guint8 (tvb
, offset
);
973 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
974 hf_wtls_hands_certificate_wtls_subject_type
,
980 case IDENTIFIER_NULL
:
982 case IDENTIFIER_TEXT
:
983 value
= add_text_identifier(tvb
, offset
,
984 hf_wtls_hands_certificate_wtls_subject_charset
,
985 hf_wtls_hands_certificate_wtls_subject_size
,
986 hf_wtls_hands_certificate_wtls_subject_name
,
987 wtls_msg_type_item_sub_tree
);
989 client_size
+= value
;
991 case IDENTIFIER_BIN
:
993 case IDENTIFIER_SHA_1
:
995 case IDENTIFIER_X509
:
998 public_key
= tvb_get_guint8 (tvb
, offset
);
999 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
1000 hf_wtls_hands_certificate_wtls_public_key_type
,
1005 value
= tvb_get_guint8 (tvb
, offset
);
1006 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
1007 hf_wtls_hands_certificate_wtls_key_parameter_index
,
1008 tvb
,offset
,1,ENC_BIG_ENDIAN
);
1011 if (value
== 0xff) {
1012 size
= tvb_get_ntohs (tvb
, offset
);
1013 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
1014 hf_wtls_hands_certificate_wtls_key_parameter_set
,
1015 tvb
,offset
,size
+2,ENC_ASCII
|ENC_NA
);
1017 client_size
+=size
+2;
1019 switch (public_key
) {
1020 case PUBLIC_KEY_RSA
:
1021 value
= tvb_get_ntohs (tvb
, offset
);
1022 proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
1023 hf_wtls_hands_certificate_wtls_rsa_exponent
,
1024 tvb
,offset
,value
+2,value
*8);
1026 client_size
+=2+value
;
1027 value
= tvb_get_ntohs (tvb
, offset
);
1028 proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
1029 hf_wtls_hands_certificate_wtls_rsa_modules
,
1030 tvb
,offset
,value
+2,value
*8);
1032 client_size
+=2+value
;
1034 case PUBLIC_KEY_ECDH
:
1036 case PUBLIC_KEY_ECDSA
:
1039 value
= tvb_get_ntohs (tvb
, offset
);
1040 proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
1041 hf_wtls_hands_certificate_wtls_signature
,
1042 tvb
,offset
,2+value
,value
*8);
1044 client_size
+=2+value
;
1046 case CERTIFICATE_X509
:
1047 case CERTIFICATE_X968
:
1048 value
= tvb_get_ntohs (tvb
, offset
);
1051 client_size
+= value
;
1054 case CERTIFICATE_URL
:
1055 value
= tvb_get_guint8 (tvb
, offset
);
1058 client_size
+= value
;
1062 proto_item_set_len(cli_key_item
, client_size
);
1071 /* Register the protocol with Wireshark */
1073 proto_register_wtls(void)
1076 /* Setup list of header fields */
1077 static hf_register_info hf
[] = {
1081 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_record_type_ext
, 0x0f,
1085 { &hf_wtls_record_type
,
1088 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_record_type_ext
, 0x0f,
1092 { &hf_wtls_record_length
,
1095 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1099 { &hf_wtls_record_sequence
,
1100 { "Record Sequence",
1102 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1106 { &hf_wtls_record_ciphered
,
1107 { "Record Ciphered",
1109 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1116 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_handshake_type_ext
, 0x00,
1120 { &hf_wtls_hands_type
,
1122 "wtls.handshake.type",
1123 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_handshake_type_ext
, 0x00,
1127 { &hf_wtls_hands_length
,
1129 "wtls.handshake.length",
1130 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1134 { &hf_wtls_hands_cli_hello
,
1136 "wtls.handshake.client_hello",
1137 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1141 { &hf_wtls_hands_cli_hello_version
,
1143 "wtls.handshake.client_hello.version",
1144 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1148 { &hf_wtls_hands_cli_hello_gmt
,
1150 "wtls.handshake.client_hello.gmt",
1151 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1155 { &hf_wtls_hands_cli_hello_random
,
1157 "wtls.handshake.client_hello.random",
1158 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1162 { &hf_wtls_hands_cli_hello_session
,
1164 "wtls.handshake.client_hello.sessionid",
1165 FT_UINT64
, BASE_HEX_DEC
, NULL
, 0x00,
1169 { &hf_wtls_hands_cli_hello_session_str
,
1171 "wtls.handshake.client_hello.session.str",
1172 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1176 { &hf_wtls_hands_cli_hello_cli_key_id
,
1178 "wtls.handshake.client_hello.client_keys_id",
1179 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1183 { &hf_wtls_hands_cli_hello_cli_key_len
,
1185 "wtls.handshake.client_hello.client_keys_len",
1186 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1190 { &hf_wtls_hands_cli_hello_trust_key_id
,
1192 "wtls.handshake.client_hello.trusted_keys_id",
1193 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1197 { &hf_wtls_hands_cli_hello_key_exchange
,
1199 "wtls.handshake.client_hello.key.key_exchange",
1200 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_key_exchange_suite_ext
, 0x00,
1204 { &hf_wtls_hands_cli_hello_key_exchange_suite
,
1206 "wtls.handshake.client_hello.key.key_exchange.suite",
1207 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_key_exchange_suite_ext
, 0x00,
1211 { &hf_wtls_hands_cli_hello_key_parameter_index
,
1212 { "Parameter Index",
1213 "wtls.handshake.client_hello.parameter_index",
1214 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1218 { &hf_wtls_hands_cli_hello_key_parameter_set
,
1220 "wtls.handshake.client_hello.parameter",
1221 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1225 { &hf_wtls_hands_cli_hello_key_identifier_type
,
1226 { "Identifier Type",
1227 "wtls.handshake.client_hello.ident_type",
1228 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_identifier_type_ext
, 0x00,
1232 { &hf_wtls_hands_cli_hello_key_identifier_charset
,
1233 { "Identifier CharSet",
1234 "wtls.handshake.client_hello.ident_charset",
1235 FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
, &wap_mib_enum_vals_character_sets_ext
, 0x00,
1239 { &hf_wtls_hands_cli_hello_key_identifier_size
,
1240 { "Identifier Size",
1241 "wtls.handshake.client_hello.ident_size",
1242 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1246 { &hf_wtls_hands_cli_hello_key_identifier
,
1248 "wtls.handshake.client_hello.identifier",
1249 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1253 { &hf_wtls_hands_cli_hello_key_identifier_str
,
1254 { "Identifier Name",
1255 "wtls.handshake.client_hello.ident_name",
1256 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1260 { &hf_wtls_hands_cli_hello_cipher_suite
,
1262 "wtls.handshake.client_hello.ciphers",
1263 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1264 "Cipher Suite", HFILL
1267 { &hf_wtls_hands_cli_hello_cipher_suite_item
,
1269 "wtls.handshake.client_hello.cipher",
1270 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1274 { &hf_wtls_hands_cli_hello_compression_methods
,
1275 { "Compression Methods",
1276 "wtls.handshake.client_hello.comp_methods",
1277 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1281 { &hf_wtls_hands_cli_hello_compression
,
1283 "wtls.handshake.client_hello.compression",
1284 FT_UINT8
, BASE_HEX
, VALS ( wtls_vals_compression
), 0x00,
1288 { &hf_wtls_hands_cli_hello_sequence_mode
,
1290 "wtls.handshake.client_hello.sequence_mode",
1291 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_sequence_mode
), 0x00,
1295 { &hf_wtls_hands_cli_hello_key_refresh
,
1297 "wtls.handshake.client_hello.refresh",
1298 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1302 { &hf_wtls_hands_serv_hello
,
1304 "wtls.handshake.server_hello",
1305 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1309 { &hf_wtls_hands_serv_hello_version
,
1311 "wtls.handshake.server_hello.version",
1312 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1316 { &hf_wtls_hands_serv_hello_gmt
,
1318 "wtls.handshake.server_hello.gmt",
1319 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1323 { &hf_wtls_hands_serv_hello_random
,
1325 "wtls.handshake.server_hello.random",
1326 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1330 { &hf_wtls_hands_serv_hello_session
,
1332 "wtls.handshake.server_hello.sessionid",
1333 FT_UINT64
, BASE_HEX_DEC
, NULL
, 0x00,
1337 { &hf_wtls_hands_serv_hello_session_str
,
1339 "wtls.handshake.server_hello.session.str",
1340 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1344 { &hf_wtls_hands_serv_hello_cli_key_id
,
1346 "wtls.handshake.server_hello.key",
1347 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1351 { &hf_wtls_hands_serv_hello_cipher_suite_item
,
1353 "wtls.handshake.server_hello.cipher",
1354 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1358 { &hf_wtls_hands_serv_hello_cipher_bulk
,
1360 "wtls.handshake.server_hello.cipher.bulk",
1361 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_cipher_bulk_ext
, 0x00,
1365 { &hf_wtls_hands_serv_hello_cipher_mac
,
1367 "wtls.handshake.server_hello.cipher.mac",
1368 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_cipher_mac_ext
, 0x00,
1372 { &hf_wtls_hands_serv_hello_compression
,
1374 "wtls.handshake.server_hello.compression",
1375 FT_UINT8
, BASE_HEX
, VALS ( wtls_vals_compression
), 0x00,
1379 { &hf_wtls_hands_serv_hello_sequence_mode
,
1381 "wtls.handshake.server_hello.sequence_mode",
1382 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_sequence_mode
), 0x00,
1386 { &hf_wtls_hands_serv_hello_key_refresh
,
1388 "wtls.handshake.server_hello.refresh",
1389 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1393 { &hf_wtls_hands_certificates
,
1395 "wtls.handshake.certificates",
1396 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1400 { &hf_wtls_hands_certificate
,
1402 "wtls.handshake.certificate",
1403 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1407 { &hf_wtls_hands_certificate_type
,
1409 "wtls.handshake.certificate.type",
1410 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_certificate_type_ext
, 0x00,
1414 { &hf_wtls_hands_certificate_wtls_version
,
1416 "wtls.handshake.certificate.version",
1417 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1421 { &hf_wtls_hands_certificate_wtls_signature_type
,
1423 "wtls.handshake.certificate.signature.type",
1424 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_certificate_signature
), 0x00,
1428 { &hf_wtls_hands_certificate_wtls_signature
,
1430 "wtls.handshake.certificate.signature.signature",
1431 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1435 { &hf_wtls_hands_certificate_wtls_issuer_type
,
1437 "wtls.handshake.certificate.issuer.type",
1438 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_identifier_type_ext
, 0x00,
1442 { &hf_wtls_hands_certificate_wtls_issuer_charset
,
1444 "wtls.handshake.certificate.issuer.charset",
1445 FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
, &wap_mib_enum_vals_character_sets_ext
, 0x00,
1449 { &hf_wtls_hands_certificate_wtls_issuer_size
,
1451 "wtls.handshake.certificate.issuer.size",
1452 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1456 { &hf_wtls_hands_certificate_wtls_issuer_name
,
1458 "wtls.handshake.certificate.issuer.name",
1459 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1463 { &hf_wtls_hands_certificate_wtls_valid_not_before
,
1464 { "Valid not before",
1465 "wtls.handshake.certificate.before",
1466 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1470 { &hf_wtls_hands_certificate_wtls_valid_not_after
,
1471 { "Valid not after",
1472 "wtls.handshake.certificate.after",
1473 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1477 { &hf_wtls_hands_certificate_wtls_subject_type
,
1479 "wtls.handshake.certificate.subject.type",
1480 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_identifier_type_ext
, 0x00,
1484 { &hf_wtls_hands_certificate_wtls_subject_charset
,
1486 "wtls.handshake.certificate.subject.charset",
1487 FT_UINT16
, BASE_HEX
|BASE_EXT_STRING
, &wap_mib_enum_vals_character_sets_ext
, 0x00,
1491 { &hf_wtls_hands_certificate_wtls_subject_size
,
1493 "wtls.handshake.certificate.subject.size",
1494 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1498 { &hf_wtls_hands_certificate_wtls_subject_name
,
1500 "wtls.handshake.certificate.subject.name",
1501 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1505 { &hf_wtls_hands_certificate_wtls_public_key_type
,
1506 { "Public Key Type",
1507 "wtls.handshake.certificate.public.type",
1508 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_public_key_type
), 0x00,
1512 { &hf_wtls_hands_certificate_wtls_key_parameter_index
,
1513 { "Parameter Index",
1514 "wtls.handshake.certificate.parameter_index",
1515 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1519 { &hf_wtls_hands_certificate_wtls_key_parameter_set
,
1521 "wtls.handshake.certificate.parameter",
1522 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1526 { &hf_wtls_hands_certificate_wtls_rsa_exponent
,
1527 { "RSA Exponent Size",
1528 "wtls.handshake.certificate.rsa.exponent",
1529 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1533 { &hf_wtls_hands_certificate_wtls_rsa_modules
,
1534 { "RSA Modulus Size",
1535 "wtls.handshake.certificate.rsa.modules",
1536 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1543 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1547 { &hf_wtls_alert_level
,
1550 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_alert_level
), 0x00,
1554 { &hf_wtls_alert_description
,
1556 "wtls.alert.description",
1557 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_alert_description_ext
, 0x00,
1563 /* Setup protocol subtree array */
1564 static gint
*ett
[] = {
1568 &ett_wtls_msg_type_item
,
1569 &ett_wtls_msg_type_item_sub
,
1570 &ett_wtls_msg_type_item_sub_sub
,
1573 /* Register the protocol name and description */
1574 proto_wtls
= proto_register_protocol(
1575 "Wireless Transport Layer Security", /* protocol name for use by wireshark */
1576 "WTLS", /* short version of name */
1577 "wtls" /* Abbreviated protocol name, should Match IANA
1578 < URL:http://www.iana.org/assignments/port-numbers/ >
1582 /* Required function calls to register the header fields and subtrees used */
1583 proto_register_field_array(proto_wtls
, hf
, array_length(hf
));
1584 proto_register_subtree_array(ett
, array_length(ett
));
1588 proto_reg_handoff_wtls(void)
1590 dissector_handle_t wtls_handle
;
1592 wtls_handle
= create_dissector_handle(dissect_wtls
, proto_wtls
);
1593 dissector_add_uint("udp.port", UDP_PORT_WTLS_WSP
, wtls_handle
);
1594 dissector_add_uint("udp.port", UDP_PORT_WTLS_WTP_WSP
, wtls_handle
);
1595 dissector_add_uint("udp.port", UDP_PORT_WTLS_WSP_PUSH
,wtls_handle
);