Bug 357462

Summary: Decryption failure when message has no version header
Product: [Applications] kgpg Reporter: Richard B <mynameisrichardb>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: CONFIRMED ---    
Severity: minor CC: hallo, harindudilshan95
Priority: NOR    
Version First Reported In: 2.14.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 18.04.2
Sentry Crash Report:

Description Richard B 2016-01-03 07:58:18 UTC
I was trying to decrypt a message which had no GPG version header in it. I would get a "Decryption failed" notice. When clicking on the "Details" button, it would show the program's steps of decrypting, but would also display the message in there. So I figured it was weird that it says failure, but has the message decrypted correctly anyway. I have since did more testing with this bug, and found an easy workaround. All that was missing was a blank line before the cipher-text. Problem was the sender of said message uses a different GPG frontend that when using the --no-version option, doesn't include that blank line.

Reproducible: Always

Steps to Reproduce:
1. Be sent an encrypted message without the version header (and no blank line/whitespace between the begin PGP message header and ciphertext.)
2. Decrypt message
3. Check for more details, find message in there.

Actual Results:  
I was able to read my message within the detailed program logs of the decryption failure notice.

Expected Results:  
Ideally, it should have been able to detect whether or not there's a whitespace/version header or otherwise isolate on the cipher-text, and decrypt text accordingly without causing a false failure. 

Of course the simple fix is to add in a whitespace yourself between begin pgp message header and cipher-text.

Details of failed decryption notice:
[GNUPG:] NEED_PASSPHRASE **************** **************** 1 0
[GNUPG:] GOT_IT
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_INFO 0 3
[GNUPG:] PLAINTEXT 62 1451806294 
[GNUPG:] PLAINTEXT_LENGTH 14
THIS
IS
A
BUG
[GNUPG:] DECRYPTION_OKAY
[GNUPG:] END_DECRYPTION
Comment 1 nowi 2016-06-01 06:59:01 UTC
I can confirm this confusing behaviour. 
Kgpg failure notice should not include the decrypted message.

bye 
nowi

KGpg Version 2.17.0
KDE 4.14.16
Comment 2 Kavinda 2018-05-08 22:43:55 UTC
The problem is that even though Gpg decrypts the message, it returns a exit code(2). Thus Kgpg thinks decryption failed.