1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! SSH handshake components.
//!

use crate::utils::base64;

use serde::Serialize;

/// A parsed SSH Protocol Version Exchange message.
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
pub struct SshVersionExchange {
    pub protoversion: Option<String>,
    pub softwareversion: Option<String>,
    pub comments: Option<String>,
}

/// A parsed SSH Key Exchange message.
#[derive(Debug, PartialEq, Serialize)]
pub struct SshKeyExchange {
    #[serde(with = "base64")]
    pub cookie: Vec<u8>,
    pub kex_algs: Vec<String>,
    pub server_host_key_algs: Vec<String>,
    pub encryption_algs_client_to_server: Vec<String>,
    pub encryption_algs_server_to_client: Vec<String>,
    pub mac_algs_client_to_server: Vec<String>,
    pub mac_algs_server_to_client: Vec<String>,
    pub compression_algs_client_to_server: Vec<String>,
    pub compression_algs_server_to_client: Vec<String>,
    pub languages_client_to_server: Vec<String>,
    pub languages_server_to_client: Vec<String>,
    pub first_kex_packet_follows: bool,
}

/// A parsed Diffie-Hellman Key Exchange message sent by the client.
#[derive(Debug, Default, Serialize)]
pub struct SshDhInit {
    pub e: Vec<u8>,
}

/// A parsed Diffie-Hellman Key Exchange message sent by the server.
#[derive(Debug, Default, Serialize)]
pub struct SshDhResponse {
    pub pubkey_and_certs: Vec<u8>,
    pub f: Vec<u8>,
    pub signature: Vec<u8>,
}

#[derive(Debug, Default, Serialize)]
pub struct SshNewKeys;