summaryrefslogtreecommitdiffstats
path: root/src/pki.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-07 17:49:02 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-08 15:28:31 +0200
commit9bed334da3b0f18eee326300b5a8a8b4ff5d5875 (patch)
treebe953e3af3e1e3ed1a31b9315cbe18d40014498a /src/pki.c
parent7c302d376c3c31b1d4a311e5813dc3632b387609 (diff)
downloadlibssh-9bed334da3b0f18eee326300b5a8a8b4ff5d5875.tar.gz
libssh-9bed334da3b0f18eee326300b5a8a8b4ff5d5875.tar.xz
libssh-9bed334da3b0f18eee326300b5a8a8b4ff5d5875.zip
pki: Add ssh_pki_convert_key_to_privatekey().
Diffstat (limited to 'src/pki.c')
-rw-r--r--src/pki.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pki.c b/src/pki.c
index 57b3ad2..593cc41 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -293,6 +293,22 @@ ssh_public_key ssh_pki_convert_key_to_publickey(ssh_key key) {
return pub;
}
+ssh_private_key ssh_pki_convert_key_to_privatekey(ssh_key key) {
+ ssh_private_key privkey;
+
+ privkey = malloc(sizeof(struct ssh_private_key_struct));
+ if (privkey == NULL) {
+ ssh_key_free(key);
+ return NULL;
+ }
+
+ privkey->type = key->type;
+ privkey->dsa_priv = key->dsa;
+ privkey->rsa_priv = key->rsa;
+
+ return privkey;
+}
+
/** @brief import a base64 formated key from a memory c-string
*
* @param key The key to fill, created with ssh_key_new()