No Secret key = no decryption.
ClosedPublic

Authored by knauss on Mar 29 2016, 2:46 PM.

Details

Summary

Show the user that we are missing a secrect key to decrypt instead of
a general error message.

Diff Detail

Repository
R94 PIM: Message Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
knauss updated this revision to Diff 3006.Mar 29 2016, 2:46 PM
knauss retitled this revision from to No Secret key = no decryption..
knauss updated this object.
knauss edited the test plan for this revision. (Show Details)
knauss added reviewers: mlaurent, aheinecke, dvratil.

This has also a visual change. With the patch the failed decryption looks like this:

instead to:

knauss added a subscriber: KDE PIM.
aheinecke accepted this revision.Mar 29 2016, 3:54 PM
aheinecke edited edge metadata.

Both my comments are just suggestions ship it as is if you want as it already improves the situation imo.

Generally I would like to see such handling in libkleo so that we can unify it. I basically need the same code in Kleopatra where decryption failed with no secret key currently leads to the very useful error: "Decryption Failed: Decryption Failed." :-) Something to talk about next weekend in Toulouse I guess.

mimetreeparser/src/viewer/objecttreeparser.cpp
689

Why auto? This always returns a vector of Recipients.

700

Imo it would be more user friendly to show the primary UID there if it is available.

This would mean to create a new context and use context->key to obtain the key and then include the first uid if it is available. If no key is available you could fallback to showing just the key id.

You should do this in a second loop as it involves calls to gnupg or gpgsm.

This revision is now accepted and ready to land.Mar 29 2016, 3:54 PM
This revision was automatically updated to reflect the committed changes.

it is now commited but still some open questions

mimetreeparser/src/viewer/objecttreeparser.cpp
689

Because i think it is easier to read without the long type defintion. I replaced the auto with the concrete type.

But IMO we should discuss this in Toulouse too:
https://steveire.wordpress.com/2016/03/19/aaargh-aaa-right-good-and-hygenic/

700

mmh yes something to make better - therefore I would need the a Kleo::KeyListJob ?

aheinecke added inline comments.Mar 30 2016, 1:24 PM
mimetreeparser/src/viewer/objecttreeparser.cpp
700

If you want you can do this with a keylistjob. You can also use gpgme++ directly. But you then also need some pretty print code especially for S/MIME Recipients to handle the DN.

Imo we really want a solution for this in Libkleo I want to have something like this in Kleopatra's dialogs, too. Probably moving Kleopatra/src/utils/formatting.cpp into libkleo and extending it to handle stuff like decryption error. Maybe Kdepim style by using grantlee templates that are filled with error information? So that we can have a generic solution for Key lookup, uid formatting etc. and still include special stuff like kmail:showCertificate links?

knauss added inline comments.Mar 30 2016, 7:46 PM
mimetreeparser/src/viewer/objecttreeparser.cpp
700

Please do not add grantlee as dependency for textoutput. For me libkleo should give me a object, with where it is easy to create nice dialogs. For kube we want to get rid of rendering everything to html for displaying and use native UI elements, that's why it is contraproductive to switch more things to grantlee/html if it is not needed.