X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Frsautl.c;h=36957e5b8420334a355222d94e41d0995abda285;hb=c99935e32cba193c10e1933ab1b34e3931a52b9a;hp=86aa95d38a6b26456bf0e888a6c4a550d57abc6d;hpb=30b4c2724ea2a078d921ba16a51b8d3e2ad85c42;p=openssl.git diff --git a/apps/rsautl.c b/apps/rsautl.c index 86aa95d38a..36957e5b84 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -62,7 +62,6 @@ #include #include #include -#include #define RSA_SIGN 1 #define RSA_VERIFY 2 @@ -105,6 +104,9 @@ int MAIN(int argc, char **argv) argv++; if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); + + if (!load_config(bio_err, NULL)) + goto end; ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); pad = RSA_PKCS1_PADDING; @@ -120,6 +122,9 @@ int MAIN(int argc, char **argv) } else if(!strcmp(*argv, "-inkey")) { if (--argc < 1) badarg = 1; keyfile = *(++argv); + } else if (strcmp(*argv,"-keyform") == 0) { + if (--argc < 1) badarg = 1; + keyform=str2fmt(*(++argv)); } else if(!strcmp(*argv, "-engine")) { if (--argc < 1) badarg = 1; engine = *(++argv); @@ -157,35 +162,19 @@ int MAIN(int argc, char **argv) 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); - } + e = setup_engine(bio_err, engine, 0); /* FIXME: seed PRNG only if needed */ app_RAND_load_file(NULL, bio_err, 0); switch(key_type) { case KEY_PRIVKEY: - pkey = load_key(bio_err, keyfile, keyform, + pkey = load_key(bio_err, keyfile, keyform, 0, NULL, e, "Private Key"); break; case KEY_PUBKEY: - pkey = load_pubkey(bio_err, keyfile, keyform, + pkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL, e, "Public Key"); break; @@ -304,6 +293,7 @@ static void usage() BIO_printf(bio_err, "-in file input file\n"); BIO_printf(bio_err, "-out file output file\n"); BIO_printf(bio_err, "-inkey file input key\n"); + BIO_printf(bio_err, "-keyform arg private key format - default PEM\n"); BIO_printf(bio_err, "-pubin input is an RSA public\n"); BIO_printf(bio_err, "-certin input is a certificate carrying an RSA public key\n"); BIO_printf(bio_err, "-ssl use SSL v2 padding\n"); @@ -315,6 +305,8 @@ static void usage() BIO_printf(bio_err, "-encrypt encrypt with public key\n"); BIO_printf(bio_err, "-decrypt decrypt with private key\n"); BIO_printf(bio_err, "-hexdump hex dump output\n"); + BIO_printf(bio_err, "-engine e use engine e, possibly a hardware device.\n"); + } #endif