aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-09 18:05:47 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-09 18:05:47 +0200
commit9c0af42dd8a4b7a8280e030b6dac8daf79afff40 (patch)
tree45ae984740ce4bf53f72878e5bdc998c680ab1d8
parentbec483bc1874909be8fd9c8fbc909f53be5ba27a (diff)
downloadlibssh-9c0af42dd8a4b7a8280e030b6dac8daf79afff40.tar.gz
libssh-9c0af42dd8a4b7a8280e030b6dac8daf79afff40.tar.xz
libssh-9c0af42dd8a4b7a8280e030b6dac8daf79afff40.zip
pki: Use a consistent name scheme.
Rename ssh_key_import_private to ssh_pki_import_privkey_file.
-rw-r--r--include/libssh/libssh.h2
-rw-r--r--src/bind.c4
-rw-r--r--src/legacy.c2
-rw-r--r--src/pki.c26
4 files changed, 21 insertions, 13 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index ac73bc02..8e606d5a 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -429,7 +429,7 @@ LIBSSH_API int ssh_pki_import_privkey_base64(ssh_session session,
const char *b64_key,
const char *passphrase,
ssh_key *pkey);
-LIBSSH_API int ssh_key_import_private(ssh_session session,
+LIBSSH_API int ssh_pki_import_privkey_file(ssh_session session,
const char *filename,
const char *passphrase,
ssh_key *pkey);
diff --git a/src/bind.c b/src/bind.c
index 0dd1ebb5..7a2f049b 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -309,7 +309,7 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
}
if (sshbind->dsakey) {
- rc = ssh_key_import_private(session, sshbind->dsakey, NULL, &dsa);
+ rc = ssh_pki_import_privkey_file(session, sshbind->dsakey, NULL, &dsa);
if (rc == SSH_ERROR) {
return SSH_ERROR;
}
@@ -321,7 +321,7 @@ int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {
}
if (sshbind->rsakey) {
- rc = ssh_key_import_private(session, sshbind->rsakey, NULL, &rsa);
+ rc = ssh_pki_import_privkey_file(session, sshbind->rsakey, NULL, &rsa);
if (rc == SSH_ERROR) {
return SSH_ERROR;
}
diff --git a/src/legacy.c b/src/legacy.c
index ee74b343..ee5f896e 100644
--- a/src/legacy.c
+++ b/src/legacy.c
@@ -274,7 +274,7 @@ ssh_private_key privatekey_from_file(ssh_session session,
(void) type; /* unused */
- rc = ssh_key_import_private(session, filename, passphrase, &key);
+ rc = ssh_pki_import_privkey_file(session, filename, passphrase, &key);
if (rc == SSH_ERROR) {
return NULL;
}
diff --git a/src/pki.c b/src/pki.c
index 73e2edde..7685dfa1 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -200,19 +200,27 @@ int ssh_key_is_private(ssh_key k) {
}
/**
- * @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
- * be used to ask for the passphrase.
+ * @brief Import a key from a file.
+ *
+ * @param[in] session The SSH Session to use. If a authentication callback is
+ * set, it will be used to ask for the passphrase.
+ *
* @param[in] filename The filename of the the private key.
- * @param[in] passphrase The passphrase to decrypt the private key. Set to null
+ *
+ * @param[in] passphrase The passphrase to decrypt the private key. Set to NULL
* if none is needed or it is unknown.
+ *
+ * @param[out] pkey A pointer to store the ssh_key. You need to free the
+ * key.
+ *
* @returns SSH_OK on success, SSH_ERROR otherwise.
+ *
+ * @see ssh_key_free()
**/
-int ssh_key_import_private(ssh_session session,
- const char *filename,
- const char *passphrase,
- ssh_key *pkey) {
+int ssh_pki_import_privkey_file(ssh_session session,
+ const char *filename,
+ const char *passphrase,
+ ssh_key *pkey) {
struct stat sb;
char *key_buf;
ssh_key key;