pki: Use a consistent name scheme.
Rename ssh_key_import_private to ssh_pki_import_privkey_file.
Этот коммит содержится в:
родитель
bec483bc18
Коммит
9c0af42dd8
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
26
src/pki.c
26
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;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user