Home GnuPG

qt: Check passphrase constraints before accepting passphrase

Description

qt: Check passphrase constraints before accepting passphrase

* qt/main.cpp (qt_cmd_handler): Pass constraints options to the dialog.
* qt/pinentrydialog.h (PinEntryDialog): Add struct ConstraintsOptions.
Add enum PassphraseCheckResult. Add fields mEnforceConstraints,
mConstraintsHint, mConstraintsErrorTitle.
* qt/pinentrydialog.h, qt/pinentrydialog.cpp
(PinEntryDialog::setConstraintsOptions, PinEntryDialog::onAccept,
PinEntryDialog::checkConstraints): New.
* qt/pinentrydialog.cpp (PinEntryDialog::PinEntryDialog): Initialize
new fields. Call onAccept() on click on Ok. Add widget for constraints
hint.
(PinEntryDialog::checkCapsLock): Constify variable.

This makes pinentry-qt check whether the entered passphrase satisfies
the passphrase constraints in case the constraints are enforced by
gpg-agent. If the constraints are not satisfied the user is informed,
so that they can modify the passphrase.