summaryrefslogtreecommitdiffstats
path: root/src/legacy.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-16 17:54:10 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-16 17:54:10 +0200
commit9b84464748d5d4cd67b7868a6cfba5664a169503 (patch)
tree9ee1e76a53f891a9ca8e21c7f974a425c8e1eff1 /src/legacy.c
parenta40f1d85972986c8baa2e32fe666c7bf19423045 (diff)
downloadlibssh-9b84464748d5d4cd67b7868a6cfba5664a169503.tar.gz
libssh-9b84464748d5d4cd67b7868a6cfba5664a169503.tar.xz
libssh-9b84464748d5d4cd67b7868a6cfba5664a169503.zip
pki: Make publickey_to_string a legacy function.
Diffstat (limited to 'src/legacy.c')
-rw-r--r--src/legacy.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/legacy.c b/src/legacy.c
index c021a4b..ac9ace1 100644
--- a/src/legacy.c
+++ b/src/legacy.c
@@ -381,6 +381,29 @@ ssh_public_key publickey_from_string(ssh_session session, ssh_string pubkey_s) {
return pubkey;
}
+ssh_string publickey_to_string(ssh_public_key pubkey) {
+ ssh_key key;
+ ssh_string key_blob;
+
+ key = ssh_key_new();
+ if (key == NULL) {
+ return NULL;
+ }
+
+ key->type = pubkey->type;
+ key->type_c = pubkey->type_c;
+
+ key->dsa = pubkey->dsa_pub;
+ key->rsa = pubkey->rsa_pub;
+
+ key_blob = ssh_pki_publickey_to_blob(key);
+
+ key->dsa = NULL;
+ key->rsa = NULL;
+ ssh_key_free(key);
+
+ return key_blob;
+}
/****************************************************************************
* SERVER SUPPORT
****************************************************************************/