When encrypting a file with --symmetric option, gpg asks for the passphrase using the pinentry program (small window). I want it to reject passphrases below a certain length.

How can I do this?


This cannot be configured with gpg. You need the gpg-agent configuration to do that. Have a look at its man page and see the options --min-passphrase-len and --enforce-passphrase-constraints.

As you probably not want to have all passphrase operations be affected by them you may use a separate configuration:

mkdir ~/.gnupg-symmetric
$EDITOR ~/.gnupg-symmetric/gpg-agent.conf # add those options
GPG_AGENT_INFO= gpg --homedir ~/.gnupg-symmetric --symmetric file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.