Page MenuHome GnuPG

Improve decryption error message caused by deleted card key
Open, NormalPublic

Description

When trying to decrypt a file which is only encrypted to a deleted key which was on a already connected smart card you get an error message like:

C:\Users\g10code\Documents>gpg -d "C:\Users\g10code\Documents\Le er Zeichen  + T E S T.txt.gpg"
gpg: verschlüsselt mit 256-Bit ECDH Schlüssel, ID ACCA5BB181004DC7, erzeugt 2025-01-08
      "g10code"
gpg: Entschlüsselung mit Public-Key-Verfahren fehlgeschlagen: Ungültige ID
gpg: Entschlüsselung fehlgeschlagen: Kein geheimer Schlüssel

That is "invalid ID" in the first and "no secret key" in the second line

This is confusing, we should improve the error message.
(In Kleopatra, only the "Invalid ID" is shown in the decryption window.)

A hint for the user what they could/should do would be nice.

Details

Version
gpg 2.2.46

Event Timeline

werner triaged this task as Normal priority.Mon, Feb 3, 11:54 AM
werner added a project: kleopatra.
werner added a subscriber: werner.

FWIW, If a fix is really required for gnupg this will be done for gnupg26 and not for gnupg22. However, it is mostly a kleopatra issue.

I'm not sure what Kleopatra should do differently. Kleopatra relies on the error messages provided by gpgme which in turn relies on gpg's status messages.