Kleopatra: Verification of embedded S/MIME p7s signature file fails, if a file without the .p7s extension exists next to it
Open, LowPublic

Assigned To
None
Authored By
timegrid
Wed, Nov 11, 2:24 PM

Description

Given 2 files:

  • embedded.txt: any file
  • embedded.txt.p7s: an embedded S/MIME signature

On verification of the p7s file, Kleopatra shows this error:

Failed to decrypt ‘embedded.txt.p7s’: Conflicting use.
Note: You cannot be sure who encrypted this message as it is not signed.

Verification of the renamed p7s file (e.g. embedded2.txt.p7s) succeeds:

The embedded signature was signed by ted and created with:

gpgsm --sign --armor --output embedded.txt.p7s embedded.txt

Logs:


Debugview

2	9.729231	7788	kleopatra.exe	org.kde.pim.libkleo: Classified based on content as: 113
3	9.730107	7788	kleopatra.exe	org.kde.pim.libkleo: Classified based on content as: 113
4	9.730157	7788	kleopatra.exe	org.kde.pim.kleopatra: classified "C:/Users/g10/Desktop/testdata/embedded.txt.p7s" as "CMS, DetachedSignature, OpaqueSignature, ClearsignedMessage"
5	9.730253	7788	kleopatra.exe	org.kde.pim.kleopatra: Detached CMS verify:  "C:/Users/g10/Desktop/testdata/embedded.txt.p7s"
6	9.731942	7788	kleopatra.exe	org.kde.pim.kleopatra: dirs QList("C:/Users/g10/Desktop/testdata/")
7	9.751513	7788	kleopatra.exe	org.kde.pim.kleopatra: Task:  "Verifying ‘embedded.txt’ with ‘embedded.txt.p7s’..."  has no total progress set. 
8	9.824671	7788	kleopatra.exe	org.kde.pim.kleopatra: GpgME::VerificationResult(
9	9.824671	7788	kleopatra.exe	 error:      GpgME::Error(50331718 (Conflicting use))
10	9.824671	7788	kleopatra.exe	 fileName:   
11	9.824671	7788	kleopatra.exe	 signatures:
12	9.824671	7788	kleopatra.exe	)
13	9.824847	7788	kleopatra.exe	org.kde.pim.kleopatra: Task:  "Verifying ‘embedded.txt’ with ‘embedded.txt.p7s’..."  has no total progress set. 
14	9.825104	7788	kleopatra.exe	org.kde.pim.kleopatra: Task:  "Verifying ‘embedded.txt’ with ‘embedded.txt.p7s’..."  has no total progress set. 
15	9.825188	7788	kleopatra.exe	org.kde.pim.libkleo: errorAsString gettext_use_utf8(-1) returns 1
16	9.825216	7788	kleopatra.exe	org.kde.pim.libkleo: errorAsString error: "Conflicting use"
17	9.825492	7788	kleopatra.exe	org.kde.pim.libkleo: errorAsString error (percent-encoded): "Conflicting%20use"
18	9.828786	7788	kleopatra.exe	org.kde.pim.kleopatra: not showing link (not available)
19	9.829823	7788	kleopatra.exe	org.kde.pim.kleopatra: All done

Details

Version
gpg4win-5.2.0-beta882 (gpg-2.5.24, gpgol-2.7.4) @ win11

Event Timeline

timegrid created this object with edit policy "Contributor (Project)".
timegrid updated the task description. (Show Details)
timegrid updated the task description. (Show Details)

I had a quick look at the code and found this comment:

// We can't reliably detect CMS detached signatures, so we will try to do
// our best to use the current file as a detached signature and fallback to
// opaque signature otherwise.

So, Kleopatra behaves as intended. This could still be improved, e.g. by detecting the Conflicting use error and then trying to treat the file as opaque signature. Or maybe there is a way to detect at least some CMS opaque signatures. Apparently, gpgsm does detect the non-detached signature.

Since this is Low priority I'll leave it at that for now.