aboutsummaryrefslogtreecommitdiffstats
path: root/apps/ca.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/ca.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/ca.c')
-rw-r--r--apps/ca.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/apps/ca.c b/apps/ca.c
index a4bc7bd6fe..921e1f1840 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -702,34 +702,12 @@ bad:
BIO_printf(bio_err,"Error getting password\n");
goto err;
}
- if (keyform == FORMAT_ENGINE)
- {
- if (!e)
- {
- BIO_printf(bio_err,"no engine specified\n");
- goto err;
- }
- pkey = ENGINE_load_private_key(e, keyfile, key);
- }
- else if (keyform == FORMAT_PEM)
- {
- if (BIO_read_filename(in,keyfile) <= 0)
- {
- perror(keyfile);
- BIO_printf(bio_err,"trying to load CA private key\n");
- goto err;
- }
- pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,key);
- }
- else
- {
- BIO_printf(bio_err,"bad input format specified for key file\n");
- goto err;
- }
+ pkey = load_key(bio_err, keyfile, keyform, key, e,
+ "CA private key");
if (key) memset(key,0,strlen(key));
if (pkey == NULL)
{
- BIO_printf(bio_err,"unable to load CA private key\n");
+ /* load_key() has already printed an appropriate message */
goto err;
}