Subject: | decryption fails, as --use-agent option is missing |
The --use-agent option must be passed in order to use gpg-agent to retrieve the cached key; otherwise, decryption will fail.
A demonstration:
: [ether@tequila ~].4$; perl -MConfig::Identity::GitHub -MData::Dumper -wle'my %foo = Config::Identity::GitHub->load; print Dumper \%foo;'
at /Users/ether/.perlbrew/libs/16.3@std/lib/perl5/Config/Identity/GitHub.pm line 14.
Error during decryption of /Users/ether/.github:
gpg: Invalid passphrase; please try again ...
gpg: Invalid passphrase; please try again ...
gpg: decryption failed: secret key not available
at /Users/ether/.perlbrew/libs/16.3@std/lib/perl5/Config/Identity/GitHub.pm line 14.
This is what Config::Identity is doing:
: [ether@tequila ~].4$; gpg -qd --no-tty --command-fd 0 --status-fd 1 < .github
[GNUPG:] ENC_TO BD955D77C2B6692D 1 0
[GNUPG:] USERID_HINT BD955D77C2B6692D Karen Etheridge (ether) <karen@etheridge.ca>
[GNUPG:] NEED_PASSPHRASE BD955D77C2B6692D 0CA331865BB69730 1 0
[GNUPG:] GET_HIDDEN passphrase.enter
[GNUPG:] GOT_IT
[GNUPG:] BAD_PASSPHRASE BD955D77C2B6692D
gpg: Invalid passphrase; please try again ...
[GNUPG:] USERID_HINT BD955D77C2B6692D Karen Etheridge (ether) <karen@etheridge.ca>
[GNUPG:] NEED_PASSPHRASE BD955D77C2B6692D 0CA331865BB69730 1 0
[GNUPG:] GET_HIDDEN passphrase.enter
[GNUPG:] GOT_IT
[GNUPG:] BAD_PASSPHRASE BD955D77C2B6692D
gpg: Invalid passphrase; please try again ...
[GNUPG:] USERID_HINT BD955D77C2B6692D Karen Etheridge (ether) <karen@etheridge.ca>
[GNUPG:] NEED_PASSPHRASE BD955D77C2B6692D 0CA331865BB69730 1 0
[GNUPG:] GET_HIDDEN passphrase.enter
[GNUPG:] GOT_IT
[GNUPG:] BAD_PASSPHRASE BD955D77C2B6692D
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_FAILED
gpg: decryption failed: secret key not available
[GNUPG:] END_DECRYPTION
This is what Config::Identity should do:
: [ether@tequila ~].4$; gpg -qd --no-tty --use-agent --command-fd 0 --status-fd 1 < .github
[GNUPG:] ENC_TO BD955D77C2B6692D 1 0
[GNUPG:] USERID_HINT BD955D77C2B6692D Karen Etheridge (ether) <karen@etheridge.ca>
[GNUPG:] NEED_PASSPHRASE BD955D77C2B6692D 0CA331865BB69730 1 0
[GNUPG:] GOOD_PASSPHRASE
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_INFO 2 9
[GNUPG:] PLAINTEXT 62 1367874324 .github.orig
[GNUPG:] PLAINTEXT_LENGTH 37
login karenetheridge
password <redacted>
[GNUPG:] DECRYPTION_OKAY
[GNUPG:] GOODMDC
[GNUPG:] END_DECRYPTION