aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dgst.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2001-05-30 15:29:28 +0000
committerRichard Levitte <levitte@openssl.org>2001-05-30 15:29:28 +0000
commit30b4c2724ea2a078d921ba16a51b8d3e2ad85c42 (patch)
tree551cb4a7545944a838e3a1f571dabce14bea1a24 /apps/dgst.c
parent2adc929367129a845ae2aa8358e645d4dbb9c624 (diff)
downloadopenssl-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/dgst.c')
-rw-r--r--apps/dgst.c49
1 files changed, 8 insertions, 41 deletions
diff --git a/apps/dgst.c b/apps/dgst.c
index a6b2e309c4..a010ba0719 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -289,52 +289,19 @@ int MAIN(int argc, char **argv)
if(keyfile)
{
- if (keyform == FORMAT_PEM)
- {
- BIO *keybio;
- keybio = BIO_new_file(keyfile, "r");
- if(!keybio)
- {
- BIO_printf(bio_err,
- "Error opening key file %s\n",
- keyfile);
- ERR_print_errors(bio_err);
- goto end;
- }
- if(want_pub)
- sigkey = PEM_read_bio_PUBKEY(keybio,
- NULL, NULL, NULL);
- else
- sigkey = PEM_read_bio_PrivateKey(keybio,
- NULL, NULL, NULL);
- BIO_free(keybio);
- }
- else if (keyform == FORMAT_ENGINE)
- {
- if (!e)
- {
- BIO_printf(bio_err,"no engine specified\n");
- goto end;
- }
- if (want_pub)
- sigkey = ENGINE_load_public_key(e, keyfile, NULL);
- else
- sigkey = ENGINE_load_private_key(e, keyfile, NULL);
- }
+ if (want_pub)
+ sigkey = load_pubkey(bio_err, keyfile, keyform, NULL,
+ e, "key file");
else
+ sigkey = load_key(bio_err, keyfile, keyform, NULL,
+ e, "key file");
+ if (!sigkey)
{
- BIO_printf(bio_err,
- "bad input format specified for key file\n");
+ /* load_[pub]key() has already printed an appropriate
+ message */
goto end;
}
-
- if(!sigkey) {
- BIO_printf(bio_err, "Error reading key file %s\n",
- keyfile);
- ERR_print_errors(bio_err);
- goto end;
}
- }
if(sigfile && sigkey) {
BIO *sigbio;