diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2015-01-20 17:34:21 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-02-02 14:45:52 +0100 |
commit | 46bc11f97765a5243851c11eef57d1bff3bbdc59 (patch) | |
tree | a756c2bef016e8f39fb5ca78c1739b8ac4060094 /src/pki.c | |
parent | 119840b0a97402d97850b670de070ec1a0428590 (diff) | |
download | libssh-46bc11f97765a5243851c11eef57d1bff3bbdc59.tar.gz libssh-46bc11f97765a5243851c11eef57d1bff3bbdc59.tar.xz libssh-46bc11f97765a5243851c11eef57d1bff3bbdc59.zip |
ed25519: Add support to export OpenSSH container keys
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/pki.c')
-rw-r--r-- | src/pki.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -529,7 +529,8 @@ int ssh_pki_import_privkey_file(const char *filename, } /** - * @brief Export a private key to a pam file on disk. + * @brief Export a private key to a pem file on disk, or OpenSSH format for + * keytype ssh-ed25519 * * @param[in] privkey The private key to export. * @@ -565,11 +566,17 @@ int ssh_pki_export_privkey_file(const ssh_key privkey, return SSH_EOF; } - - blob = pki_private_key_to_pem(privkey, - passphrase, - auth_fn, - auth_data); + if (privkey->type == SSH_KEYTYPE_ED25519){ + blob = ssh_pki_openssh_privkey_export(privkey, + passphrase, + auth_fn, + auth_data); + } else { + blob = pki_private_key_to_pem(privkey, + passphrase, + auth_fn, + auth_data); + } if (blob == NULL) { fclose(fp); return -1; |