From 31c39b05337590c3f64dac265a0e6dbba53f7e91 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 28 Jul 2019 09:15:41 -0700 Subject: 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. --- src/session.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/session.rs') 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); -- cgit v1.2.3