mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
pki: Rename ssh_pki_import_pubkey_string and make it public.
It should be named ssh_pki_import_pubkey_blob().
This commit is contained in:
@@ -437,6 +437,9 @@ LIBSSH_API int ssh_pki_import_pubkey_base64(ssh_session session,
|
|||||||
const char *b64_key,
|
const char *b64_key,
|
||||||
enum ssh_keytypes_e type,
|
enum ssh_keytypes_e type,
|
||||||
ssh_key *pkey);
|
ssh_key *pkey);
|
||||||
|
LIBSSH_API int ssh_pki_import_pubkey_blob(ssh_session session,
|
||||||
|
const ssh_string key_blob,
|
||||||
|
ssh_key *pkey);
|
||||||
|
|
||||||
LIBSSH_API int ssh_userauth_pki_pubkey(ssh_session session, const char *username,
|
LIBSSH_API int ssh_userauth_pki_pubkey(ssh_session session, const char *username,
|
||||||
ssh_string publickey, ssh_key privatekey);
|
ssh_string publickey, ssh_key privatekey);
|
||||||
|
@@ -78,9 +78,6 @@ ssh_private_key ssh_pki_convert_key_to_privatekey(ssh_key key);
|
|||||||
ssh_key pki_private_key_from_base64(ssh_session session,
|
ssh_key pki_private_key_from_base64(ssh_session session,
|
||||||
const char *b64_key,
|
const char *b64_key,
|
||||||
const char *passphrase);
|
const char *passphrase);
|
||||||
int ssh_pki_import_pubkey_string(ssh_session session,
|
|
||||||
const ssh_string pubkey,
|
|
||||||
ssh_key *pkey);
|
|
||||||
struct signature_struct *pki_do_sign(const ssh_key privatekey,
|
struct signature_struct *pki_do_sign(const ssh_key privatekey,
|
||||||
const unsigned char *hash);
|
const unsigned char *hash);
|
||||||
|
|
||||||
|
@@ -387,7 +387,7 @@ struct ssh_public_key_struct *agent_get_next_ident(struct ssh_session_struct *se
|
|||||||
ssh_string_free(tmp);
|
ssh_string_free(tmp);
|
||||||
|
|
||||||
/* get key from blob */
|
/* get key from blob */
|
||||||
rc = ssh_pki_import_pubkey_string(session, blob, &key);
|
rc = ssh_pki_import_pubkey_blob(session, blob, &key);
|
||||||
ssh_string_free(blob);
|
ssh_string_free(blob);
|
||||||
if (rc == SSH_ERROR) {
|
if (rc == SSH_ERROR) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
13
src/pki.c
13
src/pki.c
@@ -542,7 +542,8 @@ int ssh_pki_import_pubkey_base64(ssh_session session,
|
|||||||
*
|
*
|
||||||
* @param[in] session The ssh session to use.
|
* @param[in] session The ssh session to use.
|
||||||
*
|
*
|
||||||
* @param[in] keystring The key as a string to import.
|
* @param[in] key_blob The key blob to import as specified in RFC 4253 section
|
||||||
|
* 6.6 "Public Key Algorithms".
|
||||||
*
|
*
|
||||||
* @param[out] pkey A pointer where the key can be stored. You need
|
* @param[out] pkey A pointer where the key can be stored. You need
|
||||||
* to free the memory.
|
* to free the memory.
|
||||||
@@ -551,15 +552,15 @@ int ssh_pki_import_pubkey_base64(ssh_session session,
|
|||||||
*
|
*
|
||||||
* @see ssh_key_free()
|
* @see ssh_key_free()
|
||||||
*/
|
*/
|
||||||
int ssh_pki_import_pubkey_string(ssh_session session,
|
int ssh_pki_import_pubkey_blob(ssh_session session,
|
||||||
const ssh_string pubkey,
|
const ssh_string key_blob,
|
||||||
ssh_key *pkey) {
|
ssh_key *pkey) {
|
||||||
ssh_buffer buffer;
|
ssh_buffer buffer;
|
||||||
ssh_string type_s = NULL;
|
ssh_string type_s = NULL;
|
||||||
char *type_c = NULL;
|
char *type_c = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (pubkey == NULL || pkey == NULL) {
|
if (key_blob == NULL || pkey == NULL) {
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,8 +570,8 @@ int ssh_pki_import_pubkey_string(ssh_session session,
|
|||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = buffer_add_data(buffer, ssh_string_data(pubkey),
|
rc = buffer_add_data(buffer, ssh_string_data(key_blob),
|
||||||
ssh_string_len(pubkey));
|
ssh_string_len(key_blob));
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
ssh_set_error_oom(session);
|
ssh_set_error_oom(session);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Reference in New Issue
Block a user