diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-16 00:46:34 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-16 00:47:43 +0200 |
commit | 19a3f5a61d96f4dbbb60b3a3fc19e50dde6870c0 (patch) | |
tree | 1b941bc34de222905e9c42fe664b1c88de672158 /src/legacy.c | |
parent | 9dfef44fd88292ab19f46bdfa428e5378f5ae41f (diff) | |
download | libssh-19a3f5a61d96f4dbbb60b3a3fc19e50dde6870c0.tar.gz libssh-19a3f5a61d96f4dbbb60b3a3fc19e50dde6870c0.tar.xz libssh-19a3f5a61d96f4dbbb60b3a3fc19e50dde6870c0.zip |
pki: Make publickey_from_file() a legacy function.
Diffstat (limited to 'src/legacy.c')
-rw-r--r-- | src/legacy.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/legacy.c b/src/legacy.c index a17cb82..ed75490 100644 --- a/src/legacy.c +++ b/src/legacy.c @@ -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 ****************************************************************************/ |