mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
APPS: Add passphrase handling in the "rsa" and "dsa" commands
They completely ignored any passphrase related setting. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15119)
This commit is contained in:
parent
49ce003740
commit
5432d827ec
14
apps/dsa.c
14
apps/dsa.c
@ -267,6 +267,20 @@ int dsa_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Passphrase setup */
|
||||
if (enc != NULL)
|
||||
OSSL_ENCODER_CTX_set_cipher(ectx, EVP_CIPHER_name(enc), NULL);
|
||||
|
||||
/* Default passphrase prompter */
|
||||
if (enc != NULL || outformat == FORMAT_PVK) {
|
||||
OSSL_ENCODER_CTX_set_passphrase_ui(ectx, get_ui_method(), NULL);
|
||||
if (passout != NULL)
|
||||
/* When passout given, override the passphrase prompter */
|
||||
OSSL_ENCODER_CTX_set_passphrase(ectx,
|
||||
(const unsigned char *)passout,
|
||||
strlen(passout));
|
||||
}
|
||||
|
||||
/* PVK requires a bit more */
|
||||
if (outformat == FORMAT_PVK) {
|
||||
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
|
||||
|
14
apps/rsa.c
14
apps/rsa.c
@ -335,6 +335,20 @@ int rsa_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Passphrase setup */
|
||||
if (enc != NULL)
|
||||
OSSL_ENCODER_CTX_set_cipher(ectx, EVP_CIPHER_name(enc), NULL);
|
||||
|
||||
/* Default passphrase prompter */
|
||||
if (enc != NULL || outformat == FORMAT_PVK) {
|
||||
OSSL_ENCODER_CTX_set_passphrase_ui(ectx, get_ui_method(), NULL);
|
||||
if (passout != NULL)
|
||||
/* When passout given, override the passphrase prompter */
|
||||
OSSL_ENCODER_CTX_set_passphrase(ectx,
|
||||
(const unsigned char *)passout,
|
||||
strlen(passout));
|
||||
}
|
||||
|
||||
/* PVK is a bit special... */
|
||||
if (outformat == FORMAT_PVK) {
|
||||
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
|
||||
|
Loading…
Reference in New Issue
Block a user