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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
pub(crate) mod encryption;
pub(crate) mod hash;
pub(crate) mod key_exchange;
pub(crate) mod mac;
pub(crate) mod public_key;
use strum_macros::{AsRefStr, EnumString};
use self::{hash::HashCtx, key_exchange::KeyExchange};
#[derive(Copy, Clone, PartialEq, Eq, AsRefStr, EnumString)]
pub enum Enc {
#[strum(serialize = "chacha20-poly1305@openssh.com")]
Chacha20Poly1305Openssh,
#[strum(serialize = "aes128-ctr")]
Aes128Ctr,
#[strum(serialize = "aes192-ctr")]
Aes192Ctr,
#[strum(serialize = "aes256-ctr")]
Aes256Ctr,
}
#[derive(Copy, Clone, PartialEq, Eq, AsRefStr, EnumString)]
pub enum Kex {
#[strum(serialize = "curve25519-sha256")]
Curve25519Sha256,
#[strum(serialize = "ecdh-sha2-nistp256")]
EcdhSha2Nistrp256,
#[cfg(feature = "dangerous-dh-group1-sha1")]
#[strum(serialize = "diffie-hellman-group1-sha1")]
DiffieHellmanGroup1Sha1,
#[strum(serialize = "diffie-hellman-group14-sha1")]
DiffieHellmanGroup14Sha1,
#[strum(serialize = "diffie-hellman-group14-sha256")]
DiffieHellmanGroup14Sha256,
}
#[derive(Copy, Clone, PartialEq, Eq, AsRefStr, EnumString)]
pub enum PubKey {
#[strum(serialize = "ssh-ed25519")]
SshEd25519,
#[cfg(feature = "dangerous-rsa-sha1")]
#[strum(serialize = "ssh-rsa")]
SshRsa,
#[strum(serialize = "rsa-sha2-256")]
RsaSha2_256,
#[strum(serialize = "rsa-sha2-512")]
RsaSha2_512,
}
#[derive(Copy, Clone, PartialEq, Eq, AsRefStr, EnumString)]
pub enum Mac {
#[strum(serialize = "hmac-sha1")]
HmacSha1,
#[strum(serialize = "hmac-sha2-256")]
HmacSha2_256,
#[strum(serialize = "hmac-sha2-512")]
HmacSha2_512,
}
#[derive(Copy, Clone, PartialEq, Eq, AsRefStr, EnumString)]
pub enum Compress {
#[strum(serialize = "none")]
None,
}
#[derive(Default)]
pub(crate) struct Digest {
pub hash_ctx: HashCtx,
pub key_exchange: Option<Box<dyn KeyExchange>>,
}
impl Digest {
pub fn new() -> Self {
Self {
..Default::default()
}
}
}