diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2004-12-03 13:26:56 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2004-12-03 13:26:56 +0100 |
commit | 5b40d7dd9784fe2914095717a591fd59a3f9d7e5 (patch) | |
tree | d812a9c19c5d002b9b43168718027387c8b44d5f /apps | |
parent | V1 certificates that aren't self signed can't be accepted as CAs. (diff) | |
download | openssl-5b40d7dd9784fe2914095717a591fd59a3f9d7e5.tar.xz openssl-5b40d7dd9784fe2914095717a591fd59a3f9d7e5.zip |
Add -passin argument to dgst command.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dgst.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/dgst.c b/apps/dgst.c index 3025314911..c13535f3b2 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -100,6 +100,7 @@ int MAIN(int argc, char **argv) EVP_PKEY *sigkey = NULL; unsigned char *sigbuf = NULL; int siglen = 0; + char *passargin = NULL, *passin = NULL; #ifndef OPENSSL_NO_ENGINE char *engine=NULL; #endif @@ -145,6 +146,12 @@ int MAIN(int argc, char **argv) if (--argc < 1) break; keyfile=*(++argv); } + else if (!strcmp(*argv,"-passin")) + { + if (--argc < 1) + break; + passargin=*++argv; + } else if (strcmp(*argv,"-verify") == 0) { if (--argc < 1) break; @@ -257,6 +264,12 @@ int MAIN(int argc, char **argv) BIO_set_callback_arg(in,bio_err); } + if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) + { + BIO_printf(bio_err, "Error getting password\n"); + goto end; + } + if ((in == NULL) || (bmd == NULL)) { ERR_print_errors(bio_err); @@ -298,7 +311,7 @@ int MAIN(int argc, char **argv) sigkey = load_pubkey(bio_err, keyfile, keyform, 0, NULL, e, "key file"); else - sigkey = load_key(bio_err, keyfile, keyform, 0, NULL, + sigkey = load_key(bio_err, keyfile, keyform, 0, passin, e, "key file"); if (!sigkey) { @@ -385,6 +398,8 @@ end: OPENSSL_free(buf); } if (in != NULL) BIO_free(in); + if (passin) + OPENSSL_free(passin); BIO_free_all(out); EVP_PKEY_free(sigkey); if(sigbuf) OPENSSL_free(sigbuf); |