diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-07 17:49:02 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-08 15:28:31 +0200 |
commit | 9bed334da3b0f18eee326300b5a8a8b4ff5d5875 (patch) | |
tree | be953e3af3e1e3ed1a31b9315cbe18d40014498a /src/pki.c | |
parent | 7c302d376c3c31b1d4a311e5813dc3632b387609 (diff) | |
download | libssh-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.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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() |