diff options
author | julien.pierre.boogz%sun.com <devnull@localhost> | 2008-08-04 22:58:31 +0000 |
---|---|---|
committer | julien.pierre.boogz%sun.com <devnull@localhost> | 2008-08-04 22:58:31 +0000 |
commit | cc76330f24a07ba83957361a3f831fd2a273f645 (patch) | |
tree | 34336d223aae3f08b0114340d584fc98598b2ab7 /security/nss/cmd/crmftest | |
parent | ad1d867208d68089f305c0b74270a194dd2316ca (diff) | |
download | nss-hg-cc76330f24a07ba83957361a3f831fd2a273f645.tar.gz |
Fix for bug 423839 . Add multiple PKCS#11 token password command line options to crmftest, modutil, p7sign, p7content . r=nelson
Diffstat (limited to 'security/nss/cmd/crmftest')
-rw-r--r-- | security/nss/cmd/crmftest/testcrmf.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/security/nss/cmd/crmftest/testcrmf.c b/security/nss/cmd/crmftest/testcrmf.c index c687866fb..4d6b058ea 100644 --- a/security/nss/cmd/crmftest/testcrmf.c +++ b/security/nss/cmd/crmftest/testcrmf.c @@ -1497,6 +1497,7 @@ Usage (void) "\tcrmftest -d [Database Directory] -p [Personal Cert]\n" "\t -e [Encrypter] -s [CA Certificate] [-P password]\n\n" "\t [crmf] [dsa] [decode] [cmmf] [recover] [challenge]\n" + "\t [-f password_file]\n" "Database Directory\n" "\tThis is the directory where the key3.db, cert7.db, and\n" "\tsecmod.db files are located. This is also the directory\n" @@ -1558,6 +1559,7 @@ main(int argc, char **argv) PLOptState *optstate; PLOptStatus status; char *password = NULL; + char *pwfile = NULL; int irv = 0; PRUint32 flags = 0; SECStatus rv; @@ -1570,7 +1572,7 @@ main(int argc, char **argv) memset( &signPair, 0, sizeof signPair); memset( &cryptPair, 0, sizeof cryptPair); printf ("\ncrmftest v1.0\n"); - optstate = PL_CreateOptState(argc, argv, "d:p:e:s:P:"); + optstate = PL_CreateOptState(argc, argv, "d:p:e:s:P:f:"); while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) { switch (optstate->option) { case 'd': @@ -1612,8 +1614,19 @@ main(int argc, char **argv) printf ("-P failed\n"); return 606; } + pwdata.source = PW_PLAINTEXT; + pwdata.data = password; PArg = PR_TRUE; break; + case 'f': + pwfile = PORT_Strdup(optstate->value); + if (pwfile == NULL) { + printf ("-f failed\n"); + return 607; + } + pwdata.source = PW_FROMFILE; + pwdata.data = pwfile; + break; case 0: /* positional parameter */ rv = parsePositionalParam(optstate->value, &flags); if (rv) { @@ -1635,10 +1648,6 @@ main(int argc, char **argv) flags = ~ TEST_USE_DSA; db = CERT_GetDefaultCertDB(); InitPKCS11(); - if (password) { - pwdata.source = PW_PLAINTEXT; - pwdata.data = password; - } if (flags & TEST_MAKE_CRMF_REQ) { printf("Generating CRMF request\n"); |