Bug 3834 - [PATCH] separate account prefs for S/MIME to be able to specify keys for both PGP and S/MIME
Summary: [PATCH] separate account prefs for S/MIME to be able to specify keys for both...
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/Privacy/SMIME (show other bugs)
Version: 3.15.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2017-06-15 08:32 UTC by Thomas Orgis
Modified: 2017-09-23 20:44 UTC (History)
0 users

See Also:


Attachments
preliminary patch for separate S/MIME account preferences (deleted)
2017-06-15 08:32 UTC, Thomas Orgis
no flags Details
preliminary patch for separate S/MIME account preferences (without noise from distclean leftovers) (8.97 KB, patch)
2017-06-15 08:36 UTC, Thomas Orgis
no flags Details | Diff
preliminary patch for separate S/MIME account preferences (fixed PGP case and some style) (11.11 KB, patch)
2017-06-15 09:16 UTC, Thomas Orgis
no flags Details | Diff
preliminary patch for separate S/MIME account preferences (more style) (11.10 KB, patch)
2017-06-15 09:28 UTC, Thomas Orgis
no flags Details | Diff

Description Thomas Orgis 2017-06-15 08:32:08 UTC
Created attachment 1756 [details]
preliminary patch for separate S/MIME account preferences

When an account mail address has multiple S/MIME keys, one is possibly forced to
configure the key to use in the account preferences. But if PGP is also in use,
the single setting in Claws makes it impossible to have an independent choice
for the key to use for that.

I am attaching a proof-of-concept for this feature. I just duplicated the
GPG prefs into S/MIME prefs and introduced separate storage. It seems to work
nicely for me. I do not suggest to just apply this patch with it's cargo cult
approach, but it shows the functionality.

What I am not sure about is the key generation function. I presume one would
need to change things there, too, to work with S/MIME. No idea, since my
S/MIME keys come out of the web browser because of the web-based process
with the CA.
Comment 1 Thomas Orgis 2017-06-15 08:36:55 UTC
Created attachment 1757 [details]
preliminary patch for separate S/MIME account preferences (without noise from distclean leftovers)
Comment 2 Paul 2017-06-15 08:41:56 UTC
The content of attachment 1756 [details] has been deleted by
    Paul <paul@claws-mail.org>
without providing any reason.

The token used to delete this attachment was generated at 2017-06-15 08:41:52 CEST.
Comment 3 Thomas Orgis 2017-06-15 09:16:07 UTC
Created attachment 1758 [details]
preliminary patch for separate S/MIME account preferences (fixed PGP case and some style)

PGP was broken for accounts where S/MIME is configured because I did
not see that sgpgme_setup_signers() is used by both paths. Now there
is an S/MIME switch in there.

Also, I tried to adapt style to what Claws prefers.
Comment 4 Thomas Orgis 2017-06-15 09:28:34 UTC
Created attachment 1759 [details]
preliminary patch for separate S/MIME account preferences (more style)

Some style fixes. Currently I seem to have trouble with getting the correct
key for decryption. Not sure yet if it's the patch or some issue with my
setup after a migration.
Comment 5 Thomas Orgis 2017-06-15 12:00:15 UTC
Ah, I was confused by normal behaviour: When I simulate communication with
two accounts in the same claws-mail instance, I get confused by having
both the sender's and the receiver's keys available for decryption. Claws/gpg
just chooses the first suitable key and that doesn't have to match the one
I expect (mentally switching role from sender to receiver).

This behaviour has nothing to do with the patch.
Comment 6 Andrej Kacian 2017-06-24 23:13:20 UTC
Looks good so far. However, I'm not sure if using the same page widget creation func is the right way to go.

It is sufficient for now, but in the future, we may add additonal preferences for PGP and/or for SMIME privacy system, which will not be applicable to the other one. We would have to get the SMIME plugin its own function then - or we can do it now. We could either do less work now, or in the future. :)
Comment 7 Andrej Kacian 2017-06-27 14:43:12 UTC
I think the best solution would be to clearly separate the pref pages. The pgpcore plugin should provide a Plugins->OpenPGP page (renamed from current "GPG" to make it less ambiguous), and the smime plugin a Plugins->S/MIME page.

Another thing that should be improved - I don't like the extra argument to sgpgme_setup_signers(). The used signing protocol is available in the first function argument, the context struct, so the function can simply query it via gpgme_get_protocol(), and decide which config values to work with from that.
Comment 8 Thomas Orgis 2017-06-27 15:25:46 UTC
So the desired changes center around the GUI, not the choice of parameter storage 
… which is fine by me, as I know I just stitched things together to work somehow.

Regarding the differing dialogues: I'd hate to have identical code duplicated
now just for being conceptionally pure. But I do not especially care if someone
else does this duplication to feel better while applying the patch;-)

Regarding setup_signers(): If there is a function to get the protocol, all the
better. I just don't know much about the claws codebase and took what I found
at a glance.

Do you expect another revision of the patch or are you just asking for opinions?
The cosmetic points noted so far seem to be more efficinently done by someone 
who is used to working on the codebase anyway.
Comment 9 Thomas Orgis 2017-09-10 09:10:44 UTC
Anything? The patch works nicely so far for me …
Comment 10 Andrej Kacian 2017-09-11 11:26:32 UTC
I think I got stuck on thinking how to transparently handle the switch from shared preference string to the smime-specific string, for users who use smime, and then I got distracted by other stuff and never got back to this. Sorry. :)

I will try to finish this in next few days.
Comment 11 users 2017-09-23 20:44:03 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2017-09-23 20:44:03.032126305 +0200
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=31dee1bff0ec008c1e6353149912ef008ccd253a
Merge: 287b2f1 3bce048
Author: Colin Leroy <colin@colino.net>
Date:   Sat Sep 23 20:44:02 2017 +0200

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=3bce04815148589855c401da99bcabe6d2ead575
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Sat Jul 1 12:23:33 2017 +0200

    Use separate account configuration for OpenPGP and for S/MIME.
    
    This is useful for users who switch between privacy systems.
    Based on patch by Thomas Orgis.
    Closes bug Bug 3834 - [PATCH] separate account prefs for
    S/MIME to be able to specify keys for both PGP and S/MIME
Comment 12 Andrej Kacian 2017-09-23 20:44:37 UTC
Added to git, with minor changes. Thanks!

Note You need to log in before you can comment on or make changes to this bug.