diff options
author | Kenny Root <kenny@the-b.org> | 2016-06-16 00:12:53 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-06-17 17:27:50 +0000 |
commit | 5a85adda1607473e33e35d1fed96a62cf7918f3b (patch) | |
tree | f03f9f442e5c8e9a2f3e38fdca05a8c937b55b86 /epan/dissectors/packet-ssh.c | |
parent | e600526ccd5aee4686f0f8e0f2cfdf3a3c361388 (diff) |
ssh: add RSA host key printing
Adds a dissector for the ssh-rsa type of public key where the modulus
and public exponent are extracted out.
Change-Id: I10b1f2d6f41878d9f7ffe5d399b9b7d4f69ad96e
Reviewed-on: https://code.wireshark.org/review/15975
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ssh.c')
-rw-r--r-- | epan/dissectors/packet-ssh.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c index 08bad96b12..940f7aeb9d 100644 --- a/epan/dissectors/packet-ssh.c +++ b/epan/dissectors/packet-ssh.c @@ -142,6 +142,8 @@ static int hf_ssh_kexdh_host_key= -1; static int hf_ssh_hostkey_length= -1; static int hf_ssh_hostkey_type= -1; static int hf_ssh_hostkey_data= -1; +static int hf_ssh_hostkey_rsa_n= -1; +static int hf_ssh_hostkey_rsa_e= -1; static int hf_ssh_kexdh_h_sig= -1; static int hf_ssh_kexdh_h_sig_length= -1; static int hf_ssh_kex_algorithms = -1; @@ -647,9 +649,14 @@ ssh_tree_add_hostkey(tvbuff_t *tvb, int offset, proto_tree *parent_tree, const c proto_tree_add_string(tree, hf_ssh_hostkey_type, tvb, offset, type_len, key_type); offset += type_len; - remaining_len = key_len - (type_len + 4); - proto_tree_add_item(tree, hf_ssh_hostkey_data, tvb, offset, remaining_len, ENC_NA); - offset += remaining_len; + if (0 == strcmp(key_type, "ssh-rsa")) { + offset += ssh_tree_add_mpint(tvb, offset, tree, hf_ssh_hostkey_rsa_e); + offset += ssh_tree_add_mpint(tvb, offset, tree, hf_ssh_hostkey_rsa_n); + } else { + remaining_len = key_len - (type_len + 4); + proto_tree_add_item(tree, hf_ssh_hostkey_data, tvb, offset, remaining_len, ENC_NA); + offset += remaining_len; + } return 4+key_len; } @@ -1259,6 +1266,16 @@ proto_register_ssh(void) FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_ssh_hostkey_rsa_n, + { "RSA modulus (N)", "ssh.host_key.rsa.n", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_ssh_hostkey_rsa_e, + { "RSA public exponent (e)", "ssh.host_key.rsa.e", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_ssh_kexdh_h_sig_length, { "KEX DH H signature length", "ssh.kexdh.h_sig_length", FT_UINT32, BASE_DEC, NULL, 0x0, |