From 5270e7025e11b2fd1a5bdf8d81feded1167b1c87 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 26 Oct 2000 21:07:28 +0000 Subject: Merge the engine branch into the main trunk. All conflicts resolved. At the same time, add VMS support for Rijndael. --- apps/pkcs12.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'apps/pkcs12.c') diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 6789169bdb..365a8ada93 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -66,6 +66,7 @@ #include #include #include +#include #define PROG pkcs12_main @@ -92,6 +93,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { + ENGINE *e = NULL; char *infile=NULL, *outfile=NULL, *keyname = NULL; char *certfile=NULL; BIO *in=NULL, *out = NULL, *inkey = NULL, *certsin = NULL; @@ -118,6 +120,7 @@ int MAIN(int argc, char **argv) char *passin = NULL, *passout = NULL; char *inrand = NULL; char *CApath = NULL, *CAfile = NULL; + char *engine=NULL; apps_startup(); @@ -236,6 +239,11 @@ int MAIN(int argc, char **argv) args++; CAfile = *args; } else badarg = 1; + } else if (!strcmp(*args,"-engine")) { + if (args[1]) { + args++; + engine = *args; + } else badarg = 1; } else badarg = 1; } else badarg = 1; @@ -279,12 +287,27 @@ int MAIN(int argc, char **argv) BIO_printf (bio_err, "-password p set import/export password source\n"); BIO_printf (bio_err, "-passin p input file pass phrase source\n"); BIO_printf (bio_err, "-passout p output file pass phrase source\n"); + BIO_printf (bio_err, "-engine e use engine e, possibly a hardware device.\n"); BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR); BIO_printf(bio_err, " load the file (or the files in the directory) into\n"); BIO_printf(bio_err, " the random number generator\n"); goto end; } + if (engine != NULL) { + if((e = ENGINE_by_id(engine)) == NULL) { + BIO_printf(bio_err,"invalid engine \"%s\"\n", engine); + goto end; + } + if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { + BIO_printf(bio_err,"can't use that engine\n"); + goto end; + } + BIO_printf(bio_err,"engine \"%s\" set.\n", engine); + /* Free our "structural" reference. */ + ENGINE_free(e); + } + if(passarg) { if(export_cert) passargout = passarg; else passargin = passarg; -- cgit v1.2.3