diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-04-28 11:51:02 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-04-28 11:51:02 +0200 |
commit | 6885d32c05d517b32c949e17318878b1e143a83d (patch) | |
tree | e53e8870b4c48fb6348f935a710c9414add320b1 | |
parent | e5c2af631697d074bcea3f8a7393267b32673bef (diff) | |
download | libssh-6885d32c05d517b32c949e17318878b1e143a83d.tar.gz libssh-6885d32c05d517b32c949e17318878b1e143a83d.tar.xz libssh-6885d32c05d517b32c949e17318878b1e143a83d.zip |
Added ssh_privatekey_type public function
-rw-r--r-- | include/libssh/libssh.h | 3 | ||||
-rw-r--r-- | libssh/keyfiles.c | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index 75f088aa..75e7da0e 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -388,6 +388,9 @@ LIBSSH_API int ssh_pcap_file_close(ssh_pcap_file pcap); LIBSSH_API void ssh_pcap_file_free(ssh_pcap_file pcap); LIBSSH_API ssh_pcap_file ssh_pcap_file_new(void); LIBSSH_API int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename); + +LIBSSH_API int ssh_privatekey_type(ssh_private_key privatekey); + LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len); LIBSSH_API int ssh_scp_accept_request(ssh_scp scp); LIBSSH_API int ssh_scp_close(ssh_scp scp); diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index af49484f..a25af893 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -780,6 +780,20 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename, return privkey; } +/** + * @brief returns the type of a private key + * @param privatekey[in] the private key handle + * @returns one of TYPE_RSA,TYPE_DSS,TYPE_RSA1 + * @returns 0 if the type is unknown + * @see privatekey_from_file + * @see ssh_userauth_offer_pubkey + */ +int ssh_privatekey_type(ssh_private_key privatekey){ + if (privatekey==NULL) + return 0; + return privatekey->type; +} + /* same that privatekey_from_file() but without any passphrase things. */ ssh_private_key _privatekey_from_file(void *session, const char *filename, int type) { |