1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-08 19:02:06 +03:00

pki: Make publickey_from_file() a legacy function.

This commit is contained in:
Andreas Schneider
2011-08-16 00:46:34 +02:00
parent 9dfef44fd8
commit 19a3f5a61d
2 changed files with 22 additions and 87 deletions

View File

@@ -194,8 +194,6 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
void publickey_free(ssh_public_key key);
int ssh_publickey_to_file(ssh_session session, const char *file,
ssh_string pubkey, int type);
ssh_string publickey_from_file(ssh_session session, const char *filename,
int *type);
ssh_public_key publickey_from_privatekey(ssh_private_key prv);
ssh_string publickey_to_string(ssh_public_key key);
*
@@ -319,6 +317,28 @@ void privatekey_free(ssh_private_key prv) {
SAFE_FREE(prv);
}
ssh_string publickey_from_file(ssh_session session, const char *filename,
int *type) {
ssh_key key;
ssh_string key_str;
int rc;
rc = ssh_pki_import_pubkey_file(session, filename, &key);
if (rc < 0) {
return NULL;
}
key_str = ssh_pki_publickey_to_blob(key);
if (key_str == NULL) {
return NULL;
}
*type = key->type;
ssh_key_free(key);
return key_str;
}
/****************************************************************************
* SERVER SUPPORT
****************************************************************************/