mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
ed25519: Add support to export OpenSSH container keys
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
119840b0a9
commit
46bc11f977
19
src/pki.c
19
src/pki.c
@@ -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;
|
||||
|
Reference in New Issue
Block a user