summaryrefslogtreecommitdiffstats
path: root/apps/apps.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-10-28 22:40:40 +0000
committerRichard Levitte <levitte@openssl.org>2000-10-28 22:40:40 +0000
commit32d862ede4540acfdc8fe7f56bf583f7a2be3dbb (patch)
treedfe7455ed8f0d32e9c171f76122643cbb6b8dc58 /apps/apps.c
parenta44f26d5c90c068e585faffeebe10cc9c51b9e78 (diff)
Add the possibility to use keys handled by engines in more
applications.
Diffstat (limited to 'apps/apps.c')
-rw-r--r--apps/apps.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/apps.c b/apps/apps.c
index 0190d71ee2..a04f871d0a 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -553,7 +553,7 @@ end:
return(x);
}
-EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass)
+EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass, ENGINE *e)
{
BIO *key=NULL;
EVP_PKEY *pkey=NULL;
@@ -563,6 +563,14 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass)
BIO_printf(err,"no keyfile specified\n");
goto end;
}
+ if (format == FORMAT_ENGINE)
+ {
+ if (!e)
+ BIO_printf(bio_err,"no engine specified\n");
+ else
+ pkey = ENGINE_load_private_key(e, file, pass);
+ goto end;
+ }
key=BIO_new(BIO_s_file());
if (key == NULL)
{
@@ -602,7 +610,7 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass)
return(pkey);
}
-EVP_PKEY *load_pubkey(BIO *err, char *file, int format)
+EVP_PKEY *load_pubkey(BIO *err, char *file, int format, ENGINE *e)
{
BIO *key=NULL;
EVP_PKEY *pkey=NULL;
@@ -612,6 +620,14 @@ EVP_PKEY *load_pubkey(BIO *err, char *file, int format)
BIO_printf(err,"no keyfile specified\n");
goto end;
}
+ if (format == FORMAT_ENGINE)
+ {
+ if (!e)
+ BIO_printf(bio_err,"no engine specified\n");
+ else
+ pkey = ENGINE_load_public_key(e, file, NULL);
+ goto end;
+ }
key=BIO_new(BIO_s_file());
if (key == NULL)
{