use opt_passphrase, if present, before asking the user
patch supplied by Michael Bell <michael.bell@cms.hu-berlin.de> git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1804 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
a7e042fdb3
commit
9fb99e7051
|
@ -1404,6 +1404,9 @@ do_read_private_key(const char *filename, const char *format,
|
|||
char *passphrase = NULL;
|
||||
int r;
|
||||
|
||||
if (opt_passphrase)
|
||||
passphrase = opt_passphrase;
|
||||
|
||||
while (1) {
|
||||
if (!format || !strcasecmp(format, "pem")) {
|
||||
r = do_read_pem_private_key(filename, passphrase, pk);
|
||||
|
@ -1420,8 +1423,7 @@ do_read_private_key(const char *filename, const char *format,
|
|||
|
||||
if (r >= 0 || passphrase)
|
||||
break;
|
||||
if ((passphrase = opt_passphrase) != 0)
|
||||
continue;
|
||||
/* second try ... */
|
||||
passphrase = getpass("Please enter passphrase "
|
||||
"to unlock secret key: ");
|
||||
if (!passphrase)
|
||||
|
|
Loading…
Reference in New Issue