Contrary to what one might expect reading doc/DETAILS [0], encrypting to an
expired or revoked key does not specify the reason for failing, always
defaulting to "0": "No specific reason given".
Tested on Debian sid with version 1.4.16 and 2.0.22.
Steps to reproduce:
- Create/find an expired or revoked key
- Encrypt to it: $ echo spam|gpg --status-fd 2 -aer $KEYID
- Read the output: gpg: $KEYID: skipped: Unusable public key [GNUPG:] INV_RECP 0 $KEYID gpg: [stdin]: encryption failed: Unusable public key
The output for the normal user ("Unusable public key")
is not very helpful, either.
[0]
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS:
The reasons codes currently in use are: [...] - 0 :: No specific reason given [...] - 4 :: Key revoked - 5 :: Key expired [...]