[pki] Add documentation and check for NULLs
Этот коммит содержится в:
родитель
82e3068cb7
Коммит
c96314971c
13
src/pki.c
13
src/pki.c
@ -200,10 +200,23 @@ ssh_public_key ssh_pki_convert_key_to_publickey(ssh_key key) {
|
|||||||
return pub;
|
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,
|
int ssh_pki_import_privkey_base64(ssh_key key, ssh_session session,
|
||||||
const char *b64_key, const char *passphrase) {
|
const char *b64_key, const char *passphrase) {
|
||||||
ssh_private_key priv;
|
ssh_private_key priv;
|
||||||
|
|
||||||
|
if(key == NULL || session == NULL) {
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if(b64_key == NULL || !*b64_key) {
|
if(b64_key == NULL || !*b64_key) {
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user