diff options
author | milo <milo@r0ot.me> | 2011-03-17 10:08:32 +0100 |
---|---|---|
committer | milo <milo@r0ot.me> | 2011-04-14 14:05:44 +0200 |
commit | c96314971cb37240bd8c84cbbf6b9fa1b0534e7f (patch) | |
tree | 26c30fbf35d03d9789e3ad73c73f2b47533b9e78 | |
parent | 82e3068cb73c10e3420bf86db30593e58cc6f098 (diff) | |
download | libssh-c96314971cb37240bd8c84cbbf6b9fa1b0534e7f.tar.gz libssh-c96314971cb37240bd8c84cbbf6b9fa1b0534e7f.tar.xz libssh-c96314971cb37240bd8c84cbbf6b9fa1b0534e7f.zip |
[pki] Add documentation and check for NULLs
-rw-r--r-- | src/pki.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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; } |