pki_crypto: Fix private key generation with password
We need to specify a cipher when we generate a key with a password. OpenSSH uses aes_128_cbc, so we should use the same. Thanks to Julian Lunz for the report. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
b0af812710
Коммит
67b8f3d6df
@ -662,7 +662,7 @@ ssh_string pki_private_key_to_pem(const ssh_key key,
|
|||||||
} else {
|
} else {
|
||||||
rc = PEM_write_bio_DSAPrivateKey(mem,
|
rc = PEM_write_bio_DSAPrivateKey(mem,
|
||||||
key->dsa,
|
key->dsa,
|
||||||
NULL, /* cipher */
|
EVP_aes_128_cbc(),
|
||||||
NULL, /* kstr */
|
NULL, /* kstr */
|
||||||
0, /* klen */
|
0, /* klen */
|
||||||
NULL, /* auth_fn */
|
NULL, /* auth_fn */
|
||||||
@ -687,7 +687,7 @@ ssh_string pki_private_key_to_pem(const ssh_key key,
|
|||||||
} else {
|
} else {
|
||||||
rc = PEM_write_bio_RSAPrivateKey(mem,
|
rc = PEM_write_bio_RSAPrivateKey(mem,
|
||||||
key->rsa,
|
key->rsa,
|
||||||
NULL, /* cipher */
|
EVP_aes_128_cbc(),
|
||||||
NULL, /* kstr */
|
NULL, /* kstr */
|
||||||
0, /* klen */
|
0, /* klen */
|
||||||
NULL, /* auth_fn */
|
NULL, /* auth_fn */
|
||||||
@ -712,7 +712,7 @@ ssh_string pki_private_key_to_pem(const ssh_key key,
|
|||||||
} else {
|
} else {
|
||||||
rc = PEM_write_bio_ECPrivateKey(mem,
|
rc = PEM_write_bio_ECPrivateKey(mem,
|
||||||
key->ecdsa,
|
key->ecdsa,
|
||||||
NULL, /* cipher */
|
EVP_aes_128_cbc(),
|
||||||
NULL, /* kstr */
|
NULL, /* kstr */
|
||||||
0, /* klen */
|
0, /* klen */
|
||||||
NULL, /* auth_fn */
|
NULL, /* auth_fn */
|
||||||
|
@ -81,7 +81,7 @@ static void torture_pki_dsa_write_privkey(void **state)
|
|||||||
unlink(LIBSSH_DSA_TESTKEY);
|
unlink(LIBSSH_DSA_TESTKEY);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_file(origkey,
|
rc = ssh_pki_export_privkey_file(origkey,
|
||||||
"",
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
LIBSSH_DSA_TESTKEY);
|
LIBSSH_DSA_TESTKEY);
|
||||||
|
@ -354,7 +354,7 @@ static void torture_pki_ecdsa_write_privkey(void **state)
|
|||||||
unlink(LIBSSH_ECDSA_TESTKEY);
|
unlink(LIBSSH_ECDSA_TESTKEY);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_file(origkey,
|
rc = ssh_pki_export_privkey_file(origkey,
|
||||||
"",
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
LIBSSH_ECDSA_TESTKEY);
|
LIBSSH_ECDSA_TESTKEY);
|
||||||
|
@ -434,7 +434,7 @@ static void torture_pki_rsa_write_privkey(void **state)
|
|||||||
unlink(LIBSSH_RSA_TESTKEY);
|
unlink(LIBSSH_RSA_TESTKEY);
|
||||||
|
|
||||||
rc = ssh_pki_export_privkey_file(origkey,
|
rc = ssh_pki_export_privkey_file(origkey,
|
||||||
"",
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
LIBSSH_RSA_TESTKEY);
|
LIBSSH_RSA_TESTKEY);
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user