mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
agent: New option --check-sym-passphrase-pattern.
* agent/gpg-agent.c (oCheckSymPassphrasePattern): New.
(opts): Add --check-sym-passphrase-pattern.
(parse_rereadable_options): Set option.
(main): Return option info.
* tools/gpgconf-comp.c: Add new option.
* agent/agent.h (opt): Add var check_sym_passphrase_pattern.
(struct pin_entry_info_s): Add var constraints_flags.
(CHECK_CONSTRAINTS_NOT_EMPTY): New to replace a hardwired 1.
(CHECK_CONSTRAINTS_NEW_SYMKEY): New.
* agent/genkey.c (check_passphrase_pattern): Rename to ...
(do_check_passphrase_pattern): this to make code reading
easier. Handle the --check-sym-passphrase-pattern option.
(check_passphrase_constraints): Replace arg no_empty by a generic
flags arg. Also handle --check-sym-passphrase-pattern here.
* agent/command.c (cmd_get_passphrase): In --newsymkey mode pass
CHECK_CONSTRAINTS_NEW_SYMKEY flag.
* agent/call-pinentry.c (struct entry_parm_s): Add constraints_flags.
(struct inq_cb_parm_s): New.
(inq_cb): Use new struct for parameter passing. Pass flags to teh
constraints checking.
(do_getpin): Pass constraints flag down.
(agent_askpin): Take constraints flag from the supplied pinentry
struct.
--
Requirements for a passphrase to protect a private key and for a
passphrase used for symmetric encryption are different. Thus a
the use of a different pattern file will be useful. Note that a
pattern file can be used to replace the other passphrase constraints
options and thus we don't need to duplicate them for symmetric
encryption.
GnuPG-bug-id: 5517
Signed-off-by: Werner Koch <wk@gnupg.org>
Backported-from-master: 7c45a69eb9
agent: New option --check-sym-passphrase-pattern.
This commit is contained in:
parent
9832566e45
commit
c6a4a660fd
6 changed files with 88 additions and 30 deletions
|
@ -114,6 +114,7 @@ enum cmd_and_opt_values
|
|||
oMinPassphraseLen,
|
||||
oMinPassphraseNonalpha,
|
||||
oCheckPassphrasePattern,
|
||||
oCheckSymPassphrasePattern,
|
||||
oMaxPassphraseDays,
|
||||
oEnablePassphraseHistory,
|
||||
oDisableExtendedKeyFormat,
|
||||
|
@ -232,6 +233,8 @@ static ARGPARSE_OPTS opts[] = {
|
|||
ARGPARSE_s_u (oMinPassphraseLen, "min-passphrase-len", "@"),
|
||||
ARGPARSE_s_u (oMinPassphraseNonalpha, "min-passphrase-nonalpha", "@"),
|
||||
ARGPARSE_s_s (oCheckPassphrasePattern, "check-passphrase-pattern", "@"),
|
||||
ARGPARSE_s_s (oCheckSymPassphrasePattern, "check-sym-passphrase-pattern",
|
||||
"@"),
|
||||
ARGPARSE_s_u (oMaxPassphraseDays, "max-passphrase-days", "@"),
|
||||
ARGPARSE_s_n (oEnablePassphraseHistory, "enable-passphrase-history", "@"),
|
||||
|
||||
|
@ -842,6 +845,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
|
|||
opt.min_passphrase_len = MIN_PASSPHRASE_LEN;
|
||||
opt.min_passphrase_nonalpha = MIN_PASSPHRASE_NONALPHA;
|
||||
opt.check_passphrase_pattern = NULL;
|
||||
opt.check_sym_passphrase_pattern = NULL;
|
||||
opt.max_passphrase_days = MAX_PASSPHRASE_DAYS;
|
||||
opt.enable_passphrase_history = 0;
|
||||
opt.enable_extended_key_format = 1;
|
||||
|
@ -915,6 +919,9 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
|
|||
case oCheckPassphrasePattern:
|
||||
opt.check_passphrase_pattern = pargs->r.ret_str;
|
||||
break;
|
||||
case oCheckSymPassphrasePattern:
|
||||
opt.check_sym_passphrase_pattern = pargs->r.ret_str;
|
||||
break;
|
||||
case oMaxPassphraseDays:
|
||||
opt.max_passphrase_days = pargs->r.ret_ulong;
|
||||
break;
|
||||
|
@ -1422,6 +1429,8 @@ main (int argc, char **argv )
|
|||
MIN_PASSPHRASE_NONALPHA);
|
||||
es_printf ("check-passphrase-pattern:%lu:\n",
|
||||
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME);
|
||||
es_printf ("check-sym-passphrase-pattern:%lu:\n",
|
||||
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME);
|
||||
es_printf ("max-passphrase-days:%lu:%d:\n",
|
||||
GC_OPT_FLAG_DEFAULT|GC_OPT_FLAG_RUNTIME,
|
||||
MAX_PASSPHRASE_DAYS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue