diff options
author | Richard Levitte <levitte@openssl.org> | 2001-05-30 15:29:28 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-05-30 15:29:28 +0000 |
commit | 30b4c2724ea2a078d921ba16a51b8d3e2ad85c42 (patch) | |
tree | 551cb4a7545944a838e3a1f571dabce14bea1a24 /apps/req.c | |
parent | 2adc929367129a845ae2aa8358e645d4dbb9c624 (diff) | |
download | openssl-30b4c2724ea2a078d921ba16a51b8d3e2ad85c42.tar.gz |
Extend all the loading functions to take an engine pointer, a pass
string (some engines may have certificates protected by a PIN!) and
a description to put into error messages.
Also, have our own password callback that we can send both a password
and some prompt info to. The default password callback in EVP assumes
that the passed parameter is a password, which isn't always the right
thing, and the ENGINE code (at least the nCipher one) makes other
assumptions...
Also, in spite of having the functions to load keys, some utilities
did the loading all by themselves... That's changed too.
Diffstat (limited to 'apps/req.c')
-rw-r--r-- | apps/req.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/apps/req.c b/apps/req.c index f422d3e0b7..429eb9d4a0 100644 --- a/apps/req.c +++ b/apps/req.c @@ -606,40 +606,12 @@ bad: if (keyfile != NULL) { - if (keyform == FORMAT_ENGINE) + pkey = load_key(bio_err, keyfile, keyform, NULL, e, + "Private Key"); + if (!pkey) { - if (!e) - { - BIO_printf(bio_err,"no engine specified\n"); - goto end; - } - pkey = ENGINE_load_private_key(e, keyfile, NULL); - } - else - { - if (BIO_read_filename(in,keyfile) <= 0) - { - perror(keyfile); - goto end; - } - - if (keyform == FORMAT_ASN1) - pkey=d2i_PrivateKey_bio(in,NULL); - else if (keyform == FORMAT_PEM) - { - pkey=PEM_read_bio_PrivateKey(in,NULL,NULL, - passin); - } - else - { - BIO_printf(bio_err,"bad input format specified for X509 request\n"); - goto end; - } - } - - if (pkey == NULL) - { - BIO_printf(bio_err,"unable to load Private key\n"); + /* load_key() has already printed an appropriate + message */ goto end; } if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA) |