mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
pki: Make publickey_from_string a legacy function.
This commit is contained in:
29
src/legacy.c
29
src/legacy.c
@@ -352,6 +352,35 @@ int ssh_type_from_name(const char *name) {
|
||||
return ssh_key_type_from_name(name);
|
||||
}
|
||||
|
||||
ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s) {
|
||||
struct ssh_public_key_struct *pubkey;
|
||||
ssh_key key;
|
||||
int rc;
|
||||
|
||||
rc = ssh_pki_import_pubkey_blob(session, pubkey_s, &key);
|
||||
if (rc < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pubkey = malloc(sizeof(struct ssh_public_key_struct));
|
||||
if (pubkey == NULL) {
|
||||
ssh_key_free(key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pubkey->type = key->type;
|
||||
pubkey->type_c = key->type_c;
|
||||
|
||||
pubkey->dsa_pub = key->dsa;
|
||||
key->dsa = NULL;
|
||||
pubkey->rsa_pub = key->rsa;
|
||||
key->rsa = NULL;
|
||||
|
||||
ssh_key_free(key);
|
||||
|
||||
return pubkey;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* SERVER SUPPORT
|
||||
****************************************************************************/
|
||||
|
Reference in New Issue
Block a user