diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-16 18:53:18 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-16 18:53:18 +0200 |
commit | 25a21088090dcb18ef6f0b12a47bd1db6b871153 (patch) | |
tree | 53ce5494c0dc3157fb445aa6f0ab4b89142553b8 /include/libssh | |
parent | 9b84464748d5d4cd67b7868a6cfba5664a169503 (diff) | |
download | libssh-25a21088090dcb18ef6f0b12a47bd1db6b871153.tar.gz libssh-25a21088090dcb18ef6f0b12a47bd1db6b871153.tar.xz libssh-25a21088090dcb18ef6f0b12a47bd1db6b871153.zip |
pki: Remove session from ssh_pki_import_privkey_* functions.
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/callbacks.h | 15 | ||||
-rw-r--r-- | include/libssh/libssh.h | 31 | ||||
-rw-r--r-- | include/libssh/pki.h | 9 |
3 files changed, 31 insertions, 24 deletions
diff --git a/include/libssh/callbacks.h b/include/libssh/callbacks.h index 6189871..980480d 100644 --- a/include/libssh/callbacks.h +++ b/include/libssh/callbacks.h @@ -64,22 +64,7 @@ typedef void (*ssh_callback_int_int) (int code, int errno_code, void *user); typedef int (*ssh_message_callback) (ssh_session, ssh_message message, void *user); typedef int (*ssh_channel_callback_int) (ssh_channel channel, int code, void *user); typedef int (*ssh_channel_callback_data) (ssh_channel channel, int code, void *data, size_t len, void *user); -/** - * @brief SSH authentication callback. - * - * @param prompt Prompt to be displayed. - * @param buf Buffer to save the password. You should null-terminate it. - * @param len Length of the buffer. - * @param echo Enable or disable the echo of what you type. - * @param verify Should the password be verified? - * @param userdata Userdata to be passed to the callback function. Useful - * for GUI applications. - * - * @return 0 on success, < 0 on error. - */ -typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len, - int echo, int verify, void *userdata); /** * @brief SSH log callback. All logging messages will go through this callback * @param session Current session handler diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index de3480e..3acb5ae 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -417,6 +417,22 @@ LIBSSH_API int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename); LIBSSH_API enum ssh_keytypes_e ssh_privatekey_type(ssh_private_key privatekey); +/** + * @brief SSH authentication callback. + * + * @param prompt Prompt to be displayed. + * @param buf Buffer to save the password. You should null-terminate it. + * @param len Length of the buffer. + * @param echo Enable or disable the echo of what you type. + * @param verify Should the password be verified? + * @param userdata Userdata to be passed to the callback function. Useful + * for GUI applications. + * + * @return 0 on success, < 0 on error. + */ +typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len, + int echo, int verify, void *userdata); + LIBSSH_API ssh_key ssh_key_new(void); LIBSSH_API void ssh_key_free (ssh_key key); LIBSSH_API enum ssh_keytypes_e ssh_key_type(const ssh_key key); @@ -425,14 +441,17 @@ LIBSSH_API enum ssh_keytypes_e ssh_key_type_from_name(const char *name); LIBSSH_API int ssh_key_is_public(const ssh_key k); LIBSSH_API int ssh_key_is_private(const ssh_key k); -LIBSSH_API int ssh_pki_import_privkey_base64(ssh_session session, - const char *b64_key, +LIBSSH_API int ssh_pki_import_privkey_base64(const char *b64_key, const char *passphrase, + ssh_auth_callback auth_fn, + void *auth_data, ssh_key *pkey); -LIBSSH_API int ssh_pki_import_privkey_file(ssh_session session, - const char *filename, - const char *passphrase, - ssh_key *pkey); +LIBSSH_API int ssh_pki_import_privkey_file(const char *filename, + const char *passphrase, + ssh_auth_callback auth_fn, + void *auth_data, + ssh_key *pkey); + LIBSSH_API int ssh_pki_import_pubkey_base64(ssh_session session, const char *b64_key, enum ssh_keytypes_e type, diff --git a/include/libssh/pki.h b/include/libssh/pki.h index 2e9107c..60bac97 100644 --- a/include/libssh/pki.h +++ b/include/libssh/pki.h @@ -46,6 +46,8 @@ struct ssh_key_struct { void *cert; }; +void ssh_pki_log(const char *format, ...); + /* internal pki functions */ ssh_key pki_key_dup(const ssh_key key, int demote); @@ -74,9 +76,10 @@ ssh_public_key ssh_pki_convert_key_to_publickey(ssh_key key); ssh_private_key ssh_pki_convert_key_to_privatekey(ssh_key key); -ssh_key pki_private_key_from_base64(ssh_session session, - const char *b64_key, - const char *passphrase); +ssh_key pki_private_key_from_base64(const char *b64_key, + const char *passphrase, + ssh_auth_callback auth_fn, + void *auth_data); struct signature_struct *pki_do_sign(const ssh_key privatekey, const unsigned char *hash); |