aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2011-03-17 10:08:32 +0100
committermilo <milo@r0ot.me>2011-03-17 11:41:51 +0100
commit9ddaaff305c57944484a514d877676ce42776af0 (patch)
treef505bb5efb58a911de8dfbd96f6f2db72f310e6a
parentf1fdf3991758251f47e707f6de0cd97add83583c (diff)
downloadlibssh-9ddaaff305c57944484a514d877676ce42776af0.tar.gz
libssh-9ddaaff305c57944484a514d877676ce42776af0.tar.xz
libssh-9ddaaff305c57944484a514d877676ce42776af0.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;
}