diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-06-15 18:27:23 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-06-15 18:27:23 +0200 |
commit | f684e76ab224869b1a4db07cd1256876f4a71bae (patch) | |
tree | 22c3f1ff5b0d8d078553cf6bd7f5d75026a6a479 /src | |
parent | 3ba44badb00f7315dbe30aee7f5b75568fd1b0b7 (diff) | |
parent | c75581fb939e5be9ea51c1741e57b75626da03a3 (diff) | |
download | libssh-f684e76ab224869b1a4db07cd1256876f4a71bae.tar.gz libssh-f684e76ab224869b1a4db07cd1256876f4a71bae.tar.xz libssh-f684e76ab224869b1a4db07cd1256876f4a71bae.zip |
Merge branch 'pki'
Diffstat (limited to 'src')
-rw-r--r-- | src/known_hosts.c | 6 | ||||
-rw-r--r-- | src/pki.c | 30 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/known_hosts.c b/src/known_hosts.c index 7c935a8..7ec73de 100644 --- a/src/known_hosts.c +++ b/src/known_hosts.c @@ -474,6 +474,12 @@ int ssh_is_server_known(ssh_session session) { if (match) { /* We got a match. Now check the key type */ if (strcmp(session->current_crypto->server_pubkey_type, type) != 0) { + ssh_log(session, + SSH_LOG_PACKET, + "ssh_is_server_known: server type [%s] doesn't match the " + "type [%s] in known_hosts file", + session->current_crypto->server_pubkey_type, + type); /* Different type. We don't override the known_changed error which is * more important */ if (ret != SSH_SERVER_KNOWN_CHANGED) @@ -151,6 +151,36 @@ enum ssh_keytypes_e ssh_key_type_from_name(const char *name) { } /** + * @brief Check if the key has/is a public key. + * + * @param[in] k The key to check. + * + * @return 1 if it is a public key, 0 if not. + */ +int ssh_key_is_public(ssh_key k) { + if (k == NULL) { + return 0; + } + + return (k->flags & SSH_KEY_FLAG_PUBLIC); +} + +/** + * @brief Check if the key is a private key. + * + * @param[in] k The key to check. + * + * @return 1 if it is a private key, 0 if not. + */ +int ssh_key_is_private(ssh_key k) { + if (k == NULL) { + return 0; + } + + return (k->flags & SSH_KEY_FLAG_PRIVATE); +} + +/** * @brief import a key from a file * @param[out] key the ssh_key to update * @param[in] session The SSH Session to use. If a key decryption callback is set, it will |