summaryrefslogtreecommitdiff
path: root/src/session.rs
diff options
context:
space:
mode:
authorWez Furlong <wez@wezfurlong.org>2019-07-28 09:15:41 -0700
committerWez Furlong <wez@wezfurlong.org>2019-07-29 08:32:36 -0700
commit31c39b05337590c3f64dac265a0e6dbba53f7e91 (patch)
tree417acec675ed21e7956cbeca4d0c269f2652aef4 /src/session.rs
parent12ff5ea72aee8804ce41792489961523bda4cb4b (diff)
downloadssh2-rs-31c39b05337590c3f64dac265a0e6dbba53f7e91.zip
Expose more known_hosts related constants
This brings us up to date with the current set of host key and known host key enum variants so that we can parse and edit current known_hosts files. This also adds a convenience `From` impl that allows converting from the host key type to a known hosts entry type.
Diffstat (limited to 'src/session.rs')
-rw-r--r--src/session.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/session.rs b/src/session.rs
index c9dd266..4465eb0 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -565,6 +565,11 @@ impl Session {
let kind = match kind {
raw::LIBSSH2_HOSTKEY_TYPE_RSA => HostKeyType::Rsa,
raw::LIBSSH2_HOSTKEY_TYPE_DSS => HostKeyType::Dss,
+ raw::LIBSSH2_HOSTKEY_TYPE_ECDSA_256 => HostKeyType::Ecdsa256,
+ raw::LIBSSH2_HOSTKEY_TYPE_ECDSA_384 => HostKeyType::Ecdsa384,
+ raw::LIBSSH2_HOSTKEY_TYPE_ECDSA_521 => HostKeyType::Ecdsa521,
+ raw::LIBSSH2_HOSTKEY_TYPE_ED25519 => HostKeyType::Ed255219,
+ raw::LIBSSH2_HOSTKEY_TYPE_UNKNOWN => HostKeyType::Unknown,
_ => HostKeyType::Unknown,
};
Some((data, kind))
@@ -579,6 +584,7 @@ impl Session {
let len = match hash {
HashType::Md5 => 16,
HashType::Sha1 => 20,
+ HashType::Sha256 => 32,
};
unsafe {
let ret = raw::libssh2_hostkey_hash(self.raw, hash as c_int);