Home GnuPG
Diffusion GnuPG 73c03e023228

tools: Extend gpg-check-pattern.

Description

tools: Extend gpg-check-pattern.

* tools/gpg-check-pattern.c: Major rewrite.

Here is a simple pattern file:

  1. Pattern to reject passwords which do not comply to
  2. - at least 1 uppercase letter
  3. - at least 1 lowercase letter
  4. - at least one number
  5. - at least one special character
  6. and a few extra things to show the reject mode

Reject is the default mode, ignore case is the default

#[reject]
#[icase]

If the password starts with "foo" (case insensitive) it is rejected.

/foo.*/

[case]

If the password starts with "bar" (case sensitive) it is rejected.

/bar.*/

  1. Switch to accept mode: Only if all patterns up to the next "accept"
  2. or "reject" tag or EOF match, the password is accepted. Otherwise
  3. the password is rejected.

[accept]

/[A-Z]+/
/[a-z]+/
/[0-9]+/

/[^A-Za-z0-9]+/

Someone™ please write regression tests.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Jul 29 2021, 11:25 AM
Parents
rG5c8124b8b955: scd: Small clean up for card access.
Branches
Unknown
Tags
Unknown