3 * Routines to dissect WTLS component of WAP traffic.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * WAP dissector based on original work by Ben Fowler
10 * Updated by Neil Hunter <neil.hunter@energis-squared.com>
11 * WTLS support by Alexandre P. Ferreira (Splice IP)
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 #define WS_LOG_DOMAIN "packet-wtls"
19 #include <wireshark.h>
21 #include <epan/packet.h>
22 #include <epan/iana_charsets.h>
23 #include "packet-wap.h"
24 #include "packet-wtls.h"
26 void proto_register_wtls(void);
27 void proto_reg_handoff_wtls(void);
29 static dissector_handle_t wtls_handle
;
31 /* File scoped variables for the protocol and registered fields */
32 static int proto_wtls
;
34 /* These fields used by fixed part of header */
35 static int hf_wtls_record
;
36 static int hf_wtls_record_type
;
37 static int hf_wtls_record_length
;
38 static int hf_wtls_record_sequence
;
39 static int hf_wtls_record_ciphered
;
40 static int hf_wtls_hands
;
41 static int hf_wtls_hands_type
;
42 static int hf_wtls_hands_length
;
43 static int hf_wtls_hands_cli_hello
;
44 static int hf_wtls_hands_cli_hello_version
;
45 static int hf_wtls_hands_cli_hello_gmt
;
46 static int hf_wtls_hands_cli_hello_random
;
47 static int hf_wtls_hands_cli_hello_session
;
48 static int hf_wtls_hands_cli_hello_session_str
;
49 static int hf_wtls_hands_cli_hello_cli_key_id
;
50 static int hf_wtls_hands_cli_hello_cli_key_len
;
51 static int hf_wtls_hands_cli_hello_trust_key_id
;
52 static int hf_wtls_hands_cli_hello_key_exchange
;
53 static int hf_wtls_hands_cli_hello_key_exchange_suite
;
54 static int hf_wtls_hands_cli_hello_key_parameter_index
;
55 static int hf_wtls_hands_cli_hello_key_parameter_set
;
56 static int hf_wtls_hands_cli_hello_key_identifier_type
;
57 static int hf_wtls_hands_cli_hello_key_identifier_charset
;
58 static int hf_wtls_hands_cli_hello_key_identifier_size
;
59 static int hf_wtls_hands_cli_hello_key_identifier
;
60 static int hf_wtls_hands_cli_hello_key_identifier_str
;
61 static int hf_wtls_hands_cli_hello_cipher_suite
;
62 static int hf_wtls_hands_cli_hello_cipher_suite_item
;
63 static int hf_wtls_hands_cli_hello_compression_methods
;
64 static int hf_wtls_hands_cli_hello_compression
;
65 static int hf_wtls_hands_cli_hello_sequence_mode
;
66 static int hf_wtls_hands_cli_hello_key_refresh
;
67 static int hf_wtls_hands_serv_hello
;
68 static int hf_wtls_hands_serv_hello_version
;
69 static int hf_wtls_hands_serv_hello_gmt
;
70 static int hf_wtls_hands_serv_hello_random
;
71 static int hf_wtls_hands_serv_hello_session
;
72 static int hf_wtls_hands_serv_hello_session_str
;
73 static int hf_wtls_hands_serv_hello_cli_key_id
;
74 static int hf_wtls_hands_serv_hello_cipher_suite_item
;
75 static int hf_wtls_hands_serv_hello_cipher_bulk
;
76 static int hf_wtls_hands_serv_hello_cipher_mac
;
77 static int hf_wtls_hands_serv_hello_compression
;
78 static int hf_wtls_hands_serv_hello_sequence_mode
;
79 static int hf_wtls_hands_serv_hello_key_refresh
;
80 static int hf_wtls_hands_certificates
;
81 static int hf_wtls_hands_certificate
;
82 static int hf_wtls_hands_certificate_type
;
83 static int hf_wtls_hands_certificate_wtls_version
;
84 static int hf_wtls_hands_certificate_wtls_signature_type
;
85 static int hf_wtls_hands_certificate_wtls_issuer_type
;
86 static int hf_wtls_hands_certificate_wtls_issuer_charset
;
87 static int hf_wtls_hands_certificate_wtls_issuer_size
;
88 static int hf_wtls_hands_certificate_wtls_issuer_name
;
89 static int hf_wtls_hands_certificate_wtls_valid_not_before
;
90 static int hf_wtls_hands_certificate_wtls_valid_not_after
;
91 static int hf_wtls_hands_certificate_wtls_subject_type
;
92 static int hf_wtls_hands_certificate_wtls_subject_charset
;
93 static int hf_wtls_hands_certificate_wtls_subject_size
;
94 static int hf_wtls_hands_certificate_wtls_subject_name
;
95 static int hf_wtls_hands_certificate_wtls_public_key_type
;
96 static int hf_wtls_hands_certificate_wtls_key_parameter_index
;
97 static int hf_wtls_hands_certificate_wtls_key_parameter_set
;
98 static int hf_wtls_hands_certificate_wtls_rsa_exponent
;
99 static int hf_wtls_hands_certificate_wtls_rsa_modules
;
100 static int hf_wtls_hands_certificate_wtls_signature
;
101 static int hf_wtls_alert
;
102 static int hf_wtls_alert_level
;
103 static int hf_wtls_alert_description
;
105 /* Initialize the subtree pointers */
107 static int ett_wtls_rec
;
108 static int ett_wtls_msg_type
;
109 static int ett_wtls_msg_type_item
;
110 static int ett_wtls_msg_type_item_sub
;
111 static int ett_wtls_msg_type_item_sub_sub
;
113 static const value_string wtls_vals_record_type
[] = {
114 { 1, "change_cipher_data" },
117 { 4, "application_data" },
120 static value_string_ext wtls_vals_record_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_record_type
);
122 static const value_string wtls_vals_cipher_bulk
[] = {
129 { 6, "3DES CBC cwEDE40" },
130 { 7, "IDEA CBC 40" },
131 { 8, "IDEA CBC 56" },
135 static value_string_ext wtls_vals_cipher_bulk_ext
= VALUE_STRING_EXT_INIT(wtls_vals_cipher_bulk
);
137 static const value_string wtls_vals_cipher_mac
[] = {
148 static value_string_ext wtls_vals_cipher_mac_ext
= VALUE_STRING_EXT_INIT(wtls_vals_cipher_mac
);
150 static const value_string wtls_vals_handshake_type
[] = {
151 { 0, "Hello Request" },
152 { 1, "Client Hello" },
153 { 2, "Server Hello" },
154 { 11, "Certificate" },
155 { 12, "Server Key Exchange" },
156 { 13, "Certificate Request" },
157 { 14, "Server Hello Done" },
158 { 15, "Certificate Verify" },
159 { 16, "Client Key Exchange" },
163 static value_string_ext wtls_vals_handshake_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_handshake_type
);
165 static const value_string wtls_vals_key_exchange_suite
[] = {
167 { 1, "Shared Secret" },
168 { 2, "Diffie Hellman Anonymous" },
169 { 3, "Diffie Hellman Anonymous 512" },
170 { 4, "Diffie Hellman Anonymous 768" },
171 { 5, "RSA Anonymous" },
172 { 6, "RSA Anonymous 512" },
173 { 7, "RSA Anonymous 768" },
177 { 11, "EC Diffie Hellman Anonymous" },
178 { 12, "EC Diffie Hellman Anonymous 113" },
179 { 13, "EC Diffie Hellman Anonymous 131" },
180 { 14, "EC Diffie Hellman ECDSA" },
181 { 15, "EC Diffie Hellman Anonymous Uncomp" },
182 { 16, "EC Diffie Hellman Anonymous Uncomp 113" },
183 { 17, "EC Diffie Hellman Anonymous Uncomp 131" },
184 { 18, "EC Diffie Hellman ECDSA Uncomp" },
187 static value_string_ext wtls_vals_key_exchange_suite_ext
= VALUE_STRING_EXT_INIT(wtls_vals_key_exchange_suite
);
189 static const value_string wtls_vals_identifier_type
[] = {
190 { 0, "No identifier" },
191 { 1, "Textual Name" },
192 { 2, "Binary Name" },
193 { 254, "SHA-1 Hash of Public Key" },
194 { 255, "x509 Distinguished Name" },
197 static value_string_ext wtls_vals_identifier_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_identifier_type
);
199 static const value_string wtls_vals_certificate_type
[] = {
206 static value_string_ext wtls_vals_certificate_type_ext
= VALUE_STRING_EXT_INIT(wtls_vals_certificate_type
);
208 static const value_string wtls_vals_compression
[] = {
213 static const value_string wtls_vals_sequence_mode
[] = {
220 static const value_string wtls_vals_certificate_signature
[] = {
227 static const value_string wtls_vals_public_key_type
[] = {
234 static const value_string wtls_vals_alert_level
[] = {
241 static const value_string wtls_vals_alert_description
[] = {
242 { 0, "connection_close_notify"},
243 { 1, "session_close_notify"},
244 { 5, "no_connection"},
245 { 10, "unexpected_message"},
246 { 11, "time_required"},
247 { 20, "bad_record_mac"},
248 { 21, "decryption_failed"},
249 { 22, "record_overflow"},
250 { 30, "decompression_failure"},
251 { 40, "handshake_failure"},
252 { 42, "bad_certificate"},
253 { 43, "unsupported_certificate"},
254 { 44, "certificate_revoked"},
255 { 45, "certificate_expired"},
256 { 46, "certificate_unknown"},
257 { 47, "illegal_parameter"},
259 { 49, "access_denied"},
260 { 50, "decode_error"},
261 { 51, "decrypt_error"},
262 { 52, "unknown_key_id"},
263 { 53, "disabled_key_id"},
264 { 54, "key_exchange_disabled"},
265 { 55, "session_not_ready"},
266 { 56, "unknown_parameter_index"},
267 { 57, "duplicate_finished_received"},
268 { 60, "export_restriction"},
269 { 70, "protocol_version"},
270 { 71, "insufficient_security"},
271 { 80, "internal_error"},
272 { 90, "user_canceled"},
273 { 100, "no_renegotiation"},
276 static value_string_ext wtls_vals_alert_description_ext
= VALUE_STRING_EXT_INIT(wtls_vals_alert_description
);
278 #define WTLS_RECORD_TYPE_LENGTH 0x80
279 #define WTLS_RECORD_TYPE_SEQUENCE 0x40
280 #define WTLS_RECORD_TYPE_CIPHER_CUR 0x20
281 #define WTLS_RECORD_CONTENT_TYPE 0x0f
283 #define WTLS_ALERT 0x02
284 #define WTLS_PLAIN_HANDSHAKE 0x03
286 #define WTLS_HANDSHAKE_CLIENT_HELLO 1
287 #define WTLS_HANDSHAKE_SERVER_HELLO 2
288 #define WTLS_HANDSHAKE_CERTIFICATE 11
290 #define CERTIFICATE_WTLS 1
291 #define CERTIFICATE_X509 2
292 #define CERTIFICATE_X968 3
293 #define CERTIFICATE_URL 4
295 #define IDENTIFIER_NULL 0
296 #define IDENTIFIER_TEXT 1
297 #define IDENTIFIER_BIN 2
298 #define IDENTIFIER_SHA_1 254
299 #define IDENTIFIER_X509 255
301 #define PUBLIC_KEY_RSA 2
302 #define PUBLIC_KEY_ECDH 3
303 #define PUBLIC_KEY_ECDSA 4
305 static void dissect_wtls_handshake (proto_tree
*, tvbuff_t
*, unsigned, unsigned);
307 /* Code to actually dissect the packets */
309 dissect_wtls(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
315 unsigned offset_wtls
= 0;
317 /* Set up structures we will need to add the protocol subtree and manage it */
319 proto_tree
*wtls_tree
;
320 proto_tree
*wtls_rec_tree
;
321 proto_tree
*wtls_msg_type_tree
;
323 switch ( pinfo
->match_uint
)
325 case UDP_PORT_WTLS_WSP
:
326 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "WTLS+WSP" );
328 case UDP_PORT_WTLS_WTP_WSP
:
329 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "WTLS+WTP+WSP" );
333 /* Develop the string to put in the Info column */
334 col_set_str(pinfo
->cinfo
, COL_INFO
, "WTLS");
336 /* In the interest of speed, if "tree" is NULL, don't do any work not
337 necessary to generate protocol tree items. */
340 ti
= proto_tree_add_item(tree
, proto_wtls
, tvb
, offset_wtls
,
342 wtls_tree
= proto_item_add_subtree(ti
, ett_wtls
);
344 for (offset_wtls
=0; offset_wtls
< (tvb_reported_length(tvb
)-1);) {
345 pdut
= tvb_get_uint8 (tvb
, offset_wtls
);
347 offset
= offset_wtls
+1;
349 if (pdut
& WTLS_RECORD_TYPE_SEQUENCE
) {
352 if (pdut
& WTLS_RECORD_TYPE_LENGTH
) {
353 count
= tvb_get_ntohs(tvb
, offset
);
355 count
+= offset
-offset_wtls
;
358 count
= tvb_reported_length_remaining (tvb
, offset_wtls
);
360 ti
= proto_tree_add_uint(wtls_tree
, hf_wtls_record
, tvb
, offset_wtls
,
362 wtls_rec_tree
= proto_item_add_subtree(ti
, ett_wtls_rec
);
364 offset
= offset_wtls
;
366 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_type
,
367 tvb
,offset
,1,ENC_BIG_ENDIAN
);
371 offset_wtls
+= count
;
373 if (pdut
& WTLS_RECORD_TYPE_SEQUENCE
) {
374 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_sequence
,
375 tvb
,offset
,2,ENC_BIG_ENDIAN
);
378 if (pdut
& WTLS_RECORD_TYPE_LENGTH
) {
379 count
= tvb_get_ntohs(tvb
, offset
);
380 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_length
,
381 tvb
,offset
,2,ENC_BIG_ENDIAN
);
385 count
= tvb_reported_length_remaining (tvb
, offset
);
388 if (pdut
& WTLS_RECORD_TYPE_CIPHER_CUR
) {
389 proto_tree_add_item (wtls_rec_tree
, hf_wtls_record_ciphered
,
390 tvb
,offset
,count
,ENC_NA
);
394 switch (pdut
& WTLS_RECORD_CONTENT_TYPE
) {
395 case WTLS_PLAIN_HANDSHAKE
:
396 dissect_wtls_handshake(wtls_rec_tree
,tvb
,offset
,count
);
399 ti
= proto_tree_add_item(wtls_rec_tree
, hf_wtls_alert
, tvb
, offset
,
401 wtls_msg_type_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type
);
402 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_alert_level
,
403 tvb
,offset
,1,ENC_BIG_ENDIAN
);
405 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_alert_description
,
406 tvb
,offset
,1,ENC_BIG_ENDIAN
);
415 return tvb_captured_length(tvb
);
419 add_text_identifier(tvbuff_t
*tvb
, int offset
, int hf_charset
,
420 int hf_size
, int hf_str
, proto_tree
*tree
)
425 proto_tree_add_item(tree
, hf_charset
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
427 size
= tvb_get_uint8 (tvb
, offset
);
428 proto_tree_add_item(tree
, hf_size
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
430 proto_tree_add_item(tree
, hf_str
, tvb
, offset
, size
, ENC_BIG_ENDIAN
);
433 ws_debug("text id size = %d, client_size = %d",
439 add_session_id(proto_tree
*tree
, int hf
, int hf_str
, tvbuff_t
*tvb
, int offset
)
445 count
= tvb_get_uint8(tvb
, offset
);
447 proto_tree_add_string (tree
, hf_str
, tvb
, offset
, count
+1, "NULL");
448 else if (count
<= 8) {
450 for (i
= 0; i
< count
; i
++)
451 session_id
= (session_id
<< 8) | tvb_get_uint8(tvb
, offset
+ i
);
452 proto_tree_add_uint64 (tree
, hf
, tvb
, offset
, count
+1, session_id
);
454 proto_tree_add_item(tree
, hf
, tvb
, offset
, count
+1, ENC_NA
);
456 return offset
+1+count
;
460 dissect_wtls_handshake(proto_tree
*tree
, tvbuff_t
*tvb
, unsigned offset
, unsigned count
)
466 unsigned public_key
= 0;
468 const char *valBulk
= NULL
;
469 const char *valMac
= NULL
;
472 proto_item
*cli_key_item
;
473 proto_tree
*wtls_msg_type_tree
;
474 proto_tree
*wtls_msg_type_item_tree
;
475 proto_tree
*wtls_msg_type_item_sub_tree
;
476 proto_tree
*wtls_msg_type_item_sub_sub_tree
;
478 pdu_msg_type
= tvb_get_uint8 (tvb
, offset
);
479 ti
= proto_tree_add_uint(tree
, hf_wtls_hands
, tvb
, offset
,count
, pdu_msg_type
);
480 wtls_msg_type_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type
);
482 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_hands_type
,
483 tvb
,offset
,1,ENC_BIG_ENDIAN
);
485 count
= tvb_get_ntohs (tvb
, offset
);
486 proto_tree_add_item (wtls_msg_type_tree
, hf_wtls_hands_length
,
487 tvb
,offset
,2,ENC_BIG_ENDIAN
);
489 switch(pdu_msg_type
) {
490 case WTLS_HANDSHAKE_CLIENT_HELLO
:
491 ti
= proto_tree_add_item(wtls_msg_type_tree
, hf_wtls_hands_cli_hello
, tvb
, offset
,
493 wtls_msg_type_item_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item
);
494 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_cli_hello_version
,
495 tvb
,offset
,1,ENC_BIG_ENDIAN
);
497 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_cli_hello_gmt
, tvb
,
498 offset
, 4, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
500 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_cli_hello_random
,
501 tvb
,offset
,12,ENC_NA
);
503 offset
= add_session_id (wtls_msg_type_item_tree
,
504 hf_wtls_hands_cli_hello_session
,
505 hf_wtls_hands_cli_hello_session_str
,
508 /* process client_key_ids structure */
509 count
= tvb_get_ntohs (tvb
, offset
);
510 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
511 hf_wtls_hands_cli_hello_cli_key_id
, tvb
, offset
,
513 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
515 /* display length of client_key_ids structure */
516 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
517 hf_wtls_hands_cli_hello_cli_key_len
,
518 tvb
,offset
,2,ENC_BIG_ENDIAN
);
521 /* cycle through client_key_ids entries */
522 for (;count
> 0;count
-=client_size
) {
523 /* get encryption suite id (one byte) */
524 value
= tvb_get_uint8 (tvb
, offset
);
525 cli_key_item
= proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
526 hf_wtls_hands_cli_hello_key_exchange
, tvb
, offset
,1,
529 wtls_msg_type_item_sub_sub_tree
= proto_item_add_subtree(cli_key_item
,
530 ett_wtls_msg_type_item_sub_sub
);
531 proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree
,
532 hf_wtls_hands_cli_hello_key_exchange_suite
,
535 ws_debug("encryption suite = %d, client_size = %d", value
, client_size
);
537 /* get parameter index (one byte) */
538 value
= tvb_get_uint8 (tvb
, offset
);
539 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
540 hf_wtls_hands_cli_hello_key_parameter_index
,
541 tvb
,offset
,1,ENC_BIG_ENDIAN
);
544 ws_debug("parameter index = %d, client_size = %d", value
, client_size
);
546 /* explicit parameters present in next field */
548 size
= tvb_get_ntohs (tvb
, offset
);
549 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
550 hf_wtls_hands_cli_hello_key_parameter_set
,
551 tvb
,offset
,size
+2,ENC_ASCII
);
556 /* get identifier type */
557 value
= tvb_get_uint8 (tvb
, offset
);
558 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
559 hf_wtls_hands_cli_hello_key_identifier_type
,
560 tvb
,offset
,1,ENC_BIG_ENDIAN
);
563 ws_debug("identifier type = %d, client_size = %d", value
, client_size
);
565 /* identifier present in next field */
566 /* note: value 0x0 means no identifier */
568 case IDENTIFIER_TEXT
:
569 /* text identifier */
571 size
= add_text_identifier(
573 hf_wtls_hands_cli_hello_key_identifier_charset
,
574 hf_wtls_hands_cli_hello_key_identifier_size
,
575 hf_wtls_hands_cli_hello_key_identifier_str
,
576 wtls_msg_type_item_sub_sub_tree
);
580 case IDENTIFIER_BIN
:
581 /* binary identifier */
582 size
= tvb_get_uint8 (tvb
, offset
);
583 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
584 hf_wtls_hands_cli_hello_key_identifier_size
,
585 tvb
,offset
,1,ENC_BIG_ENDIAN
);
587 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
588 hf_wtls_hands_cli_hello_key_identifier
,
589 tvb
,offset
,size
,ENC_NA
);
592 ws_debug("binary id size = %d, client_size = %d",
595 case IDENTIFIER_SHA_1
:
596 /* SHA-1 hash of the public key */
597 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
598 hf_wtls_hands_cli_hello_key_identifier
,
599 tvb
,offset
,20,ENC_NA
);
602 ws_debug("SHA-1 hash size = 20, client_size = %d",
605 case IDENTIFIER_X509
:
606 /* X.509 distinguished name */
608 size
= tvb_get_uint8 (tvb
, offset
);
609 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
610 hf_wtls_hands_cli_hello_key_identifier_size
,
611 tvb
,offset
,1,ENC_BIG_ENDIAN
);
613 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
614 hf_wtls_hands_cli_hello_key_identifier
,
615 tvb
,offset
,size
,ENC_NA
);
618 ws_debug("X.509 name size = %d, client_size = %d",
623 proto_item_set_len(cli_key_item
, client_size
);
626 /* process trusted_keys structure */
627 count
= tvb_get_ntohs (tvb
, offset
);
628 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
629 hf_wtls_hands_cli_hello_trust_key_id
, tvb
, offset
,
631 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
633 /* display length of trusted_keys structure */
634 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
635 hf_wtls_hands_cli_hello_cli_key_len
,
636 tvb
,offset
,2,ENC_BIG_ENDIAN
);
639 for (;count
> 0;count
-=client_size
) {
640 /* get encryption suite id (one byte) */
641 value
= tvb_get_uint8 (tvb
, offset
);
642 cli_key_item
= proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
643 hf_wtls_hands_cli_hello_key_exchange
, tvb
, offset
,1,
646 wtls_msg_type_item_sub_sub_tree
= proto_item_add_subtree(cli_key_item
,
647 ett_wtls_msg_type_item_sub_sub
);
648 proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree
,
649 hf_wtls_hands_cli_hello_key_exchange_suite
,
652 ws_debug("encryption suite = %d, client_size = %d", value
, client_size
);
654 /* get parameter index (one byte) */
655 value
= tvb_get_uint8 (tvb
, offset
);
656 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
657 hf_wtls_hands_cli_hello_key_parameter_index
,
658 tvb
,offset
,1,ENC_BIG_ENDIAN
);
661 ws_debug("parameter index = %d, client_size = %d", value
, client_size
);
663 /* explicit parameters present in next field */
665 size
= tvb_get_ntohs (tvb
, offset
);
666 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
667 hf_wtls_hands_cli_hello_key_parameter_set
,
668 tvb
,offset
,size
+2,ENC_ASCII
);
673 /* get identifier type */
674 value
= tvb_get_uint8 (tvb
, offset
);
675 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
676 hf_wtls_hands_cli_hello_key_identifier_type
,
677 tvb
,offset
,1,ENC_BIG_ENDIAN
);
680 ws_debug("identifier type = %d, client_size = %d", value
, client_size
);
682 /* identifier present in next field */
683 /* note: value 0x0 means no identifier */
685 case IDENTIFIER_TEXT
:
686 /* text identifier */
688 size
= add_text_identifier(
690 hf_wtls_hands_cli_hello_key_identifier_charset
,
691 hf_wtls_hands_cli_hello_key_identifier_size
,
692 hf_wtls_hands_cli_hello_key_identifier_str
,
693 wtls_msg_type_item_sub_sub_tree
);
697 case IDENTIFIER_BIN
:
698 /* binary identifier */
699 size
= tvb_get_uint8 (tvb
, offset
);
700 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
701 hf_wtls_hands_cli_hello_key_identifier_size
,
702 tvb
,offset
,1,ENC_BIG_ENDIAN
);
704 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
705 hf_wtls_hands_cli_hello_key_identifier
,
706 tvb
,offset
,size
,ENC_NA
);
709 ws_debug("binary id size = %d, client_size = %d",
712 case IDENTIFIER_SHA_1
:
713 /* SHA-1 hash of the public key */
714 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
715 hf_wtls_hands_cli_hello_key_identifier
,
716 tvb
,offset
,20,ENC_NA
);
719 ws_debug("SHA-1 hash size = 20, client_size = %d",
722 case IDENTIFIER_X509
:
723 /* X.509 distinguished name */
725 size
= tvb_get_uint8 (tvb
, offset
);
726 /* need to fetch identifier and display it */
727 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
728 hf_wtls_hands_cli_hello_key_identifier_size
,
729 tvb
,offset
,1,ENC_BIG_ENDIAN
);
731 proto_tree_add_item(wtls_msg_type_item_sub_sub_tree
,
732 hf_wtls_hands_cli_hello_key_identifier
,
733 tvb
,offset
,size
,ENC_NA
);
736 ws_debug("X.509 name size = %d, client_size = %d",
740 proto_item_set_len(cli_key_item
, client_size
);
743 /* process cipher_suites structure */
744 count
= tvb_get_uint8 (tvb
, offset
);
745 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
746 hf_wtls_hands_cli_hello_cipher_suite
, tvb
, offset
,
748 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
750 for (;count
> 0;count
-=client_size
) {
751 value
= tvb_get_uint8 (tvb
, offset
);
752 valBulk
= try_val_to_str_ext(value
, &wtls_vals_cipher_bulk_ext
);
755 valMac
= try_val_to_str_ext(tvb_get_uint8 (tvb
, offset
), &wtls_vals_cipher_mac_ext
);
760 snprintf(valStr
,1024,"%s, %s",valBulk
,valMac
);
764 snprintf(valStr
,1024,"%s, Unknown MAC (0x%02x)",valBulk
,tvb_get_uint8 (tvb
, offset
));
771 snprintf(valStr
,1024,"Unknown Bulk (0x%02x), %s",value
,valMac
);
775 snprintf(valStr
,1024,"Unknown Bulk (0x%02x), Unknown MAC (0x%02x)",value
,
776 tvb_get_uint8 (tvb
, offset
));
781 proto_tree_add_string(wtls_msg_type_item_sub_tree
,
782 hf_wtls_hands_cli_hello_cipher_suite_item
, tvb
, offset
-2,2,
785 count
= tvb_get_uint8 (tvb
, offset
);
786 ti
= proto_tree_add_item(wtls_msg_type_item_tree
,
787 hf_wtls_hands_cli_hello_compression_methods
, tvb
, offset
,
789 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item_sub
);
791 for (;count
> 0;count
-=client_size
) {
793 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
794 hf_wtls_hands_cli_hello_compression
, tvb
, offset
,1,
799 proto_tree_add_item(wtls_msg_type_item_tree
,
800 hf_wtls_hands_cli_hello_sequence_mode
, tvb
, offset
,
801 1, ENC_LITTLE_ENDIAN
);
803 proto_tree_add_item(wtls_msg_type_item_tree
,
804 hf_wtls_hands_cli_hello_key_refresh
, tvb
, offset
,
805 1, ENC_LITTLE_ENDIAN
);
807 case WTLS_HANDSHAKE_SERVER_HELLO
:
808 ti
= proto_tree_add_item(wtls_msg_type_tree
, hf_wtls_hands_serv_hello
, tvb
, offset
,
810 wtls_msg_type_item_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item
);
811 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_serv_hello_version
,
812 tvb
,offset
,1,ENC_BIG_ENDIAN
);
814 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_serv_hello_gmt
, tvb
,
815 offset
, 4, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
817 proto_tree_add_item (wtls_msg_type_item_tree
, hf_wtls_hands_serv_hello_random
,
818 tvb
,offset
,12,ENC_NA
);
820 offset
= add_session_id (wtls_msg_type_item_tree
,
821 hf_wtls_hands_serv_hello_session
,
822 hf_wtls_hands_serv_hello_session_str
,
824 proto_tree_add_item(wtls_msg_type_item_tree
,
825 hf_wtls_hands_serv_hello_cli_key_id
,
826 tvb
,offset
,1,ENC_BIG_ENDIAN
);
828 cli_key_item
= proto_tree_add_item(wtls_msg_type_item_tree
,
829 hf_wtls_hands_serv_hello_cipher_suite_item
, tvb
, offset
,2,
831 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(cli_key_item
,
832 ett_wtls_msg_type_item_sub
);
833 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
834 hf_wtls_hands_serv_hello_cipher_bulk
,
835 tvb
,offset
,1,ENC_BIG_ENDIAN
);
837 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
838 hf_wtls_hands_serv_hello_cipher_mac
,
839 tvb
,offset
,1,ENC_BIG_ENDIAN
);
841 proto_tree_add_item(wtls_msg_type_item_tree
,
842 hf_wtls_hands_serv_hello_compression
, tvb
, offset
,1,
845 proto_tree_add_item(wtls_msg_type_item_tree
,
846 hf_wtls_hands_serv_hello_sequence_mode
, tvb
, offset
,
847 1, ENC_LITTLE_ENDIAN
);
849 proto_tree_add_item(wtls_msg_type_item_tree
,
850 hf_wtls_hands_serv_hello_key_refresh
, tvb
, offset
,
851 1, ENC_LITTLE_ENDIAN
);
854 case WTLS_HANDSHAKE_CERTIFICATE
:
855 ti
= proto_tree_add_item(wtls_msg_type_tree
, hf_wtls_hands_certificates
,
856 tvb
, offset
,count
, ENC_NA
);
857 wtls_msg_type_item_tree
= proto_item_add_subtree(ti
, ett_wtls_msg_type_item
);
858 count
= tvb_get_ntohs (tvb
, offset
);
860 for (;count
> 0;count
-=client_size
) {
861 cli_key_item
= proto_tree_add_item(wtls_msg_type_item_tree
,
862 hf_wtls_hands_certificate
, tvb
, offset
,1,
865 wtls_msg_type_item_sub_tree
= proto_item_add_subtree(cli_key_item
,
866 ett_wtls_msg_type_item_sub
);
867 proto_item_set_len(cli_key_item
, client_size
);
868 value
= tvb_get_uint8 (tvb
, offset
);
869 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
870 hf_wtls_hands_certificate_type
, tvb
, offset
,1,
875 case CERTIFICATE_WTLS
:
876 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
877 hf_wtls_hands_certificate_wtls_version
,
882 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
883 hf_wtls_hands_certificate_wtls_signature_type
,
888 value
= tvb_get_uint8 (tvb
, offset
);
889 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
890 hf_wtls_hands_certificate_wtls_issuer_type
,
896 case IDENTIFIER_NULL
:
898 case IDENTIFIER_TEXT
:
899 value
= add_text_identifier(tvb
, offset
,
900 hf_wtls_hands_certificate_wtls_issuer_charset
,
901 hf_wtls_hands_certificate_wtls_issuer_size
,
902 hf_wtls_hands_certificate_wtls_issuer_name
,
903 wtls_msg_type_item_sub_tree
);
905 client_size
+= value
;
907 case IDENTIFIER_BIN
:
909 case IDENTIFIER_SHA_1
:
911 case IDENTIFIER_X509
:
914 proto_tree_add_item (wtls_msg_type_item_sub_tree
,
915 hf_wtls_hands_certificate_wtls_valid_not_before
,
916 tvb
, offset
, 4, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
919 proto_tree_add_item (wtls_msg_type_item_sub_tree
,
920 hf_wtls_hands_certificate_wtls_valid_not_after
,
921 tvb
, offset
, 4, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
924 value
= tvb_get_uint8 (tvb
, offset
);
925 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
926 hf_wtls_hands_certificate_wtls_subject_type
,
932 case IDENTIFIER_NULL
:
934 case IDENTIFIER_TEXT
:
935 value
= add_text_identifier(tvb
, offset
,
936 hf_wtls_hands_certificate_wtls_subject_charset
,
937 hf_wtls_hands_certificate_wtls_subject_size
,
938 hf_wtls_hands_certificate_wtls_subject_name
,
939 wtls_msg_type_item_sub_tree
);
941 client_size
+= value
;
943 case IDENTIFIER_BIN
:
945 case IDENTIFIER_SHA_1
:
947 case IDENTIFIER_X509
:
950 public_key
= tvb_get_uint8 (tvb
, offset
);
951 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
952 hf_wtls_hands_certificate_wtls_public_key_type
,
957 value
= tvb_get_uint8 (tvb
, offset
);
958 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
959 hf_wtls_hands_certificate_wtls_key_parameter_index
,
960 tvb
,offset
,1,ENC_BIG_ENDIAN
);
964 size
= tvb_get_ntohs (tvb
, offset
);
965 proto_tree_add_item(wtls_msg_type_item_sub_tree
,
966 hf_wtls_hands_certificate_wtls_key_parameter_set
,
967 tvb
,offset
,size
+2,ENC_ASCII
);
971 switch (public_key
) {
972 case PUBLIC_KEY_RSA
:
973 value
= tvb_get_ntohs (tvb
, offset
);
974 proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
975 hf_wtls_hands_certificate_wtls_rsa_exponent
,
976 tvb
,offset
,value
+2,value
*8);
978 client_size
+=2+value
;
979 value
= tvb_get_ntohs (tvb
, offset
);
980 proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
981 hf_wtls_hands_certificate_wtls_rsa_modules
,
982 tvb
,offset
,value
+2,value
*8);
984 client_size
+=2+value
;
986 case PUBLIC_KEY_ECDH
:
988 case PUBLIC_KEY_ECDSA
:
991 value
= tvb_get_ntohs (tvb
, offset
);
992 proto_tree_add_uint(wtls_msg_type_item_sub_tree
,
993 hf_wtls_hands_certificate_wtls_signature
,
994 tvb
,offset
,2+value
,value
*8);
996 client_size
+=2+value
;
998 case CERTIFICATE_X509
:
999 case CERTIFICATE_X968
:
1000 value
= tvb_get_ntohs (tvb
, offset
);
1003 client_size
+= value
;
1006 case CERTIFICATE_URL
:
1007 value
= tvb_get_uint8 (tvb
, offset
);
1010 client_size
+= value
;
1014 proto_item_set_len(cli_key_item
, client_size
);
1023 /* Register the protocol with Wireshark */
1025 proto_register_wtls(void)
1028 /* Setup list of header fields */
1029 static hf_register_info hf
[] = {
1033 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_record_type_ext
, 0x0f,
1037 { &hf_wtls_record_type
,
1040 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_record_type_ext
, 0x0f,
1044 { &hf_wtls_record_length
,
1047 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1051 { &hf_wtls_record_sequence
,
1052 { "Record Sequence",
1054 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1058 { &hf_wtls_record_ciphered
,
1059 { "Record Ciphered",
1061 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1068 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_handshake_type_ext
, 0x00,
1072 { &hf_wtls_hands_type
,
1074 "wtls.handshake.type",
1075 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_handshake_type_ext
, 0x00,
1079 { &hf_wtls_hands_length
,
1081 "wtls.handshake.length",
1082 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1086 { &hf_wtls_hands_cli_hello
,
1088 "wtls.handshake.client_hello",
1089 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1093 { &hf_wtls_hands_cli_hello_version
,
1095 "wtls.handshake.client_hello.version",
1096 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1100 { &hf_wtls_hands_cli_hello_gmt
,
1102 "wtls.handshake.client_hello.gmt",
1103 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1107 { &hf_wtls_hands_cli_hello_random
,
1109 "wtls.handshake.client_hello.random",
1110 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1114 { &hf_wtls_hands_cli_hello_session
,
1116 "wtls.handshake.client_hello.sessionid",
1117 FT_UINT64
, BASE_HEX_DEC
, NULL
, 0x00,
1121 { &hf_wtls_hands_cli_hello_session_str
,
1123 "wtls.handshake.client_hello.session.str",
1124 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1128 { &hf_wtls_hands_cli_hello_cli_key_id
,
1130 "wtls.handshake.client_hello.client_keys_id",
1131 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1135 { &hf_wtls_hands_cli_hello_cli_key_len
,
1137 "wtls.handshake.client_hello.client_keys_len",
1138 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1142 { &hf_wtls_hands_cli_hello_trust_key_id
,
1144 "wtls.handshake.client_hello.trusted_keys_id",
1145 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1149 { &hf_wtls_hands_cli_hello_key_exchange
,
1151 "wtls.handshake.client_hello.key.key_exchange",
1152 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_key_exchange_suite_ext
, 0x00,
1156 { &hf_wtls_hands_cli_hello_key_exchange_suite
,
1158 "wtls.handshake.client_hello.key.key_exchange.suite",
1159 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_key_exchange_suite_ext
, 0x00,
1163 { &hf_wtls_hands_cli_hello_key_parameter_index
,
1164 { "Parameter Index",
1165 "wtls.handshake.client_hello.parameter_index",
1166 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1170 { &hf_wtls_hands_cli_hello_key_parameter_set
,
1172 "wtls.handshake.client_hello.parameter",
1173 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1177 { &hf_wtls_hands_cli_hello_key_identifier_type
,
1178 { "Identifier Type",
1179 "wtls.handshake.client_hello.ident_type",
1180 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_identifier_type_ext
, 0x00,
1184 { &hf_wtls_hands_cli_hello_key_identifier_charset
,
1185 { "Identifier CharSet",
1186 "wtls.handshake.client_hello.ident_charset",
1187 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &mibenum_vals_character_sets_ext
, 0x00,
1191 { &hf_wtls_hands_cli_hello_key_identifier_size
,
1192 { "Identifier Size",
1193 "wtls.handshake.client_hello.ident_size",
1194 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1198 { &hf_wtls_hands_cli_hello_key_identifier
,
1200 "wtls.handshake.client_hello.identifier",
1201 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1205 { &hf_wtls_hands_cli_hello_key_identifier_str
,
1206 { "Identifier Name",
1207 "wtls.handshake.client_hello.ident_name",
1208 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1212 { &hf_wtls_hands_cli_hello_cipher_suite
,
1214 "wtls.handshake.client_hello.ciphers",
1215 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1216 "Cipher Suite", HFILL
1219 { &hf_wtls_hands_cli_hello_cipher_suite_item
,
1221 "wtls.handshake.client_hello.cipher",
1222 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1226 { &hf_wtls_hands_cli_hello_compression_methods
,
1227 { "Compression Methods",
1228 "wtls.handshake.client_hello.comp_methods",
1229 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1233 { &hf_wtls_hands_cli_hello_compression
,
1235 "wtls.handshake.client_hello.compression",
1236 FT_UINT8
, BASE_HEX
, VALS ( wtls_vals_compression
), 0x00,
1240 { &hf_wtls_hands_cli_hello_sequence_mode
,
1242 "wtls.handshake.client_hello.sequence_mode",
1243 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_sequence_mode
), 0x00,
1247 { &hf_wtls_hands_cli_hello_key_refresh
,
1249 "wtls.handshake.client_hello.refresh",
1250 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1254 { &hf_wtls_hands_serv_hello
,
1256 "wtls.handshake.server_hello",
1257 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1261 { &hf_wtls_hands_serv_hello_version
,
1263 "wtls.handshake.server_hello.version",
1264 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1268 { &hf_wtls_hands_serv_hello_gmt
,
1270 "wtls.handshake.server_hello.gmt",
1271 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1275 { &hf_wtls_hands_serv_hello_random
,
1277 "wtls.handshake.server_hello.random",
1278 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1282 { &hf_wtls_hands_serv_hello_session
,
1284 "wtls.handshake.server_hello.sessionid",
1285 FT_UINT64
, BASE_HEX_DEC
, NULL
, 0x00,
1289 { &hf_wtls_hands_serv_hello_session_str
,
1291 "wtls.handshake.server_hello.session.str",
1292 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1296 { &hf_wtls_hands_serv_hello_cli_key_id
,
1298 "wtls.handshake.server_hello.key",
1299 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1303 { &hf_wtls_hands_serv_hello_cipher_suite_item
,
1305 "wtls.handshake.server_hello.cipher",
1306 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1310 { &hf_wtls_hands_serv_hello_cipher_bulk
,
1312 "wtls.handshake.server_hello.cipher.bulk",
1313 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_cipher_bulk_ext
, 0x00,
1317 { &hf_wtls_hands_serv_hello_cipher_mac
,
1319 "wtls.handshake.server_hello.cipher.mac",
1320 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_cipher_mac_ext
, 0x00,
1324 { &hf_wtls_hands_serv_hello_compression
,
1326 "wtls.handshake.server_hello.compression",
1327 FT_UINT8
, BASE_HEX
, VALS ( wtls_vals_compression
), 0x00,
1331 { &hf_wtls_hands_serv_hello_sequence_mode
,
1333 "wtls.handshake.server_hello.sequence_mode",
1334 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_sequence_mode
), 0x00,
1338 { &hf_wtls_hands_serv_hello_key_refresh
,
1340 "wtls.handshake.server_hello.refresh",
1341 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1345 { &hf_wtls_hands_certificates
,
1347 "wtls.handshake.certificates",
1348 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1352 { &hf_wtls_hands_certificate
,
1354 "wtls.handshake.certificate",
1355 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1359 { &hf_wtls_hands_certificate_type
,
1361 "wtls.handshake.certificate.type",
1362 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_certificate_type_ext
, 0x00,
1366 { &hf_wtls_hands_certificate_wtls_version
,
1368 "wtls.handshake.certificate.version",
1369 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1373 { &hf_wtls_hands_certificate_wtls_signature_type
,
1375 "wtls.handshake.certificate.signature.type",
1376 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_certificate_signature
), 0x00,
1380 { &hf_wtls_hands_certificate_wtls_signature
,
1382 "wtls.handshake.certificate.signature.signature",
1383 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1387 { &hf_wtls_hands_certificate_wtls_issuer_type
,
1389 "wtls.handshake.certificate.issuer.type",
1390 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_identifier_type_ext
, 0x00,
1394 { &hf_wtls_hands_certificate_wtls_issuer_charset
,
1396 "wtls.handshake.certificate.issuer.charset",
1397 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &mibenum_vals_character_sets_ext
, 0x00,
1401 { &hf_wtls_hands_certificate_wtls_issuer_size
,
1403 "wtls.handshake.certificate.issuer.size",
1404 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1408 { &hf_wtls_hands_certificate_wtls_issuer_name
,
1410 "wtls.handshake.certificate.issuer.name",
1411 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1415 { &hf_wtls_hands_certificate_wtls_valid_not_before
,
1416 { "Valid not before",
1417 "wtls.handshake.certificate.before",
1418 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1422 { &hf_wtls_hands_certificate_wtls_valid_not_after
,
1423 { "Valid not after",
1424 "wtls.handshake.certificate.after",
1425 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x00,
1429 { &hf_wtls_hands_certificate_wtls_subject_type
,
1431 "wtls.handshake.certificate.subject.type",
1432 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_identifier_type_ext
, 0x00,
1436 { &hf_wtls_hands_certificate_wtls_subject_charset
,
1438 "wtls.handshake.certificate.subject.charset",
1439 FT_UINT16
, BASE_DEC
|BASE_EXT_STRING
, &mibenum_vals_character_sets_ext
, 0x00,
1443 { &hf_wtls_hands_certificate_wtls_subject_size
,
1445 "wtls.handshake.certificate.subject.size",
1446 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1450 { &hf_wtls_hands_certificate_wtls_subject_name
,
1452 "wtls.handshake.certificate.subject.name",
1453 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1457 { &hf_wtls_hands_certificate_wtls_public_key_type
,
1458 { "Public Key Type",
1459 "wtls.handshake.certificate.public.type",
1460 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_public_key_type
), 0x00,
1464 { &hf_wtls_hands_certificate_wtls_key_parameter_index
,
1465 { "Parameter Index",
1466 "wtls.handshake.certificate.parameter_index",
1467 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1471 { &hf_wtls_hands_certificate_wtls_key_parameter_set
,
1473 "wtls.handshake.certificate.parameter",
1474 FT_STRING
, BASE_NONE
, NULL
, 0x00,
1478 { &hf_wtls_hands_certificate_wtls_rsa_exponent
,
1479 { "RSA Exponent Size",
1480 "wtls.handshake.certificate.rsa.exponent",
1481 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1485 { &hf_wtls_hands_certificate_wtls_rsa_modules
,
1486 { "RSA Modulus Size",
1487 "wtls.handshake.certificate.rsa.modules",
1488 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1495 FT_NONE
, BASE_NONE
, NULL
, 0x00,
1499 { &hf_wtls_alert_level
,
1502 FT_UINT8
, BASE_DEC
, VALS ( wtls_vals_alert_level
), 0x00,
1506 { &hf_wtls_alert_description
,
1508 "wtls.alert.description",
1509 FT_UINT8
, BASE_DEC
|BASE_EXT_STRING
, &wtls_vals_alert_description_ext
, 0x00,
1515 /* Setup protocol subtree array */
1516 static int *ett
[] = {
1520 &ett_wtls_msg_type_item
,
1521 &ett_wtls_msg_type_item_sub
,
1522 &ett_wtls_msg_type_item_sub_sub
,
1525 /* Register the protocol name and description */
1526 proto_wtls
= proto_register_protocol("Wireless Transport Layer Security", "WTLS", "wtls" );
1528 /* Required function calls to register the header fields and subtrees used */
1529 proto_register_field_array(proto_wtls
, hf
, array_length(hf
));
1530 proto_register_subtree_array(ett
, array_length(ett
));
1532 /* Register our dissector handle */
1533 wtls_handle
= register_dissector("wtls", dissect_wtls
, proto_wtls
);
1537 proto_reg_handoff_wtls(void)
1539 dissector_add_uint_range_with_preference("udp.port", UDP_PORT_WTLS_RANGE
, wtls_handle
);
1543 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1548 * indent-tabs-mode: t
1551 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1552 * :indentSize=8:tabSize=8:noTabs=false: