summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2011-03-17 10:08:32 +0100
committermilo <milo@r0ot.me>2011-04-14 14:05:44 +0200
commitc96314971cb37240bd8c84cbbf6b9fa1b0534e7f (patch)
tree26c30fbf35d03d9789e3ad73c73f2b47533b9e78
parent82e3068cb73c10e3420bf86db30593e58cc6f098 (diff)
downloadlibssh-c96314971cb37240bd8c84cbbf6b9fa1b0534e7f.tar.gz
libssh-c96314971cb37240bd8c84cbbf6b9fa1b0534e7f.tar.xz
libssh-c96314971cb37240bd8c84cbbf6b9fa1b0534e7f.zip
[pki] Add documentation and check for NULLs
-rw-r--r--src/pki.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index cb0e6a7..59d8b48 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -200,10 +200,23 @@ ssh_public_key ssh_pki_convert_key_to_publickey(ssh_key key) {
return pub;
}
+/** @brief import a base64 formated key from a memory c-string
+ *
+ * @param key The key to fill, created with ssh_key_new()
+ * @param session The ssh session
+ * @param b64_key The c-string holding the base64 encoded key
+ * @param passphrase The passphrase to decrypt the key, or NULL
+ *
+ * @return SSH_ERROR in case of error, SSH_OK otherwise
+ */
int ssh_pki_import_privkey_base64(ssh_key key, ssh_session session,
const char *b64_key, const char *passphrase) {
ssh_private_key priv;
+ if(key == NULL || session == NULL) {
+ return SSH_ERROR;
+ }
+
if(b64_key == NULL || !*b64_key) {
return SSH_ERROR;
}