aboutsummaryrefslogtreecommitdiffstats
path: root/g10/mainproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/mainproc.c')
-rw-r--r--g10/mainproc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 31d338529..4a8df6f57 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -586,6 +586,13 @@ proc_encrypted( CTX c, PACKET *pkt )
write_status( STATUS_DECRYPTION_FAILED );
}
else {
+ if (gpg_err_code (result) == GPG_ERR_BAD_KEY
+ && *c->dek->s2k_cacheid != '\0')
+ {
+ log_debug(_("cleared passphrase cached with ID: %s\n"),
+ c->dek->s2k_cacheid);
+ passphrase_clear_cache (NULL, c->dek->s2k_cacheid, 0);
+ }
write_status( STATUS_DECRYPTION_FAILED );
log_error(_("decryption failed: %s\n"), g10_errstr(result));
/* Hmmm: does this work when we have encrypted using multiple