tools: Extend gpg-check-pattern.
* tools/gpg-check-pattern.c: Major rewrite.
Here is a simple pattern file:
- Pattern to reject passwords which do not comply to
- - at least 1 uppercase letter
- - at least 1 lowercase letter
- - at least one number
- - at least one special character
- 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.*/
- Switch to accept mode: Only if all patterns up to the next "accept"
- or "reject" tag or EOF match, the password is accepted. Otherwise
- 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>