thunderbird / thunderbird-android

Thunderbird for Android – Open Source Email App for Android (fka K-9 Mail)
https://thunderbird.net/
Apache License 2.0
10.28k stars 2.48k forks source link

GPG/PGP signing key should be on identity not account #942

Open MarcusWolschon opened 8 years ago

MarcusWolschon commented 8 years ago

Currently the user has to set the signing key per account. It should be that the signing key is set per identity instead.

As the identity and key are tied to an email address but the account is not, this is the natural order of things. It also allows the user to use multiple signing keys based on his current role (answering private mails, company mail or customer mail from the same account).

Valodim commented 8 years ago

Absolutely :+1:

danwdart commented 8 years ago

This affects me in that the default signing key is always picked incorrectly

Valodim commented 8 years ago

sign/encrypt default choice should be part of this as well

MarcusWolschon commented 8 years ago

Also: My K-9 seems to forget the assigned signing key all the time. Every time I want to sign something, it says "no signing key assigned" and every time I have to assign it again. I'm however not on the Google Play Store releases since my Android Wear support still is not part of any release yet.

cketti commented 8 years ago

@MarcusWolschon: This issue is about an enhancement. You're now talking about one, possibly two, bugs. Please create new issue(s) with a reference to the Git HEAD commit of your build.

MarcusWolschon commented 8 years ago

I'm just pointing out that the issues with the signature-key may be much broader. Anyone changing to how signing keys are stored should know what else to look out for in that part of the code.

yuv commented 8 years ago

Please consider that while an identity has a one-to-one relationship to an email address, tying a key to an email address is an unnecessary limitation. Please allow users to select the key manually based on its fingerprint. Thanks.

Valodim commented 8 years ago

I don't think having multiple keys for the same identity is a valid use case. Adding this flexibility comes with a real cost in ui complexity, which I don't think is worth it.

What might be a way to do this is allow multiple identities with the same e-mail address. Anyways I didn't look at this in detail yet, so not sure.

yuv commented 8 years ago

This is not about having multiple keys for the same identity. This is about selecting an arbitrary key to sign messages from any identity without the constrain that the identity's email is also the key's emails. Enigmail does it well in Thunderbird: in Account Settings / OpenPGP Security I can either use email address of the identity to identify the OpenPGP key, or use a specific OpenPGP key ID. All it boils down to is:

Valodim commented 8 years ago

I'm not sure I understand your comment, then. This issue is about setting signing keys per identity. I thought you wanted something different?

yuv commented 8 years ago

It's the how, not the what. You can set signing keys per identity based on the email address, but this is limiting. Or you can set signing keys per identity based on the Key ID, which is in my view the right thing to do.

msebald commented 8 years ago

Yes, this has to be changed. I use one key per mail address, so I need a different key per identity. This id the biggest issue (I call it issue as I only can use PGP for the main mail address of my account) for me for the current alpha 5.108 - and besides some minor usability/frontend things the only real issue.

I would also say that keys should be set by key id, not mail addresses as there could be more that one valid private key per mail address, as it is for my case.

philipwhiuk commented 8 years ago

I think both are probably valid uses (the later implies some aspect of control over the distribution of your 'public keys' availability which is not actually enforced on a security level but might be on a practical level) but definitely a key per email is the more common one I think.

Besides which, I'm not sure K-9 does a very good job with secondary addresses per account, let alone the PGP/MIME sub-module. We probably want to formalise that better, first.

The default needs to be a default key attached to the default email address being automatically selected using opportunistic mode (sign, encrypt if possible).

We can then add better support for secondary sending addresses in K-9 and attaching OpenPGP keys to them as that secondary email's default key. (the issue for this issue).

We could then add an advanced options setting to enable you to select an arbitrary key at some point (@yuw). This would be off by default.

What we don't want to do is over-complicate the 90% case of 1 email address for 1 account with 1 key. That has to be simple and straightforward

msebald commented 8 years ago

I think my reply on this issue was not very clear, also because you first wrote something different and changed it later. ;-) But it is also not an easy thing to talk about and as already mentioned, there are so many different ways to handle keys, mail addresses and so on.

In my case it is not that straight forward as I thought. I just checked my PGP keys. In most cases I use one key for one mail address (but I also have old additional keys with the same mail addresses still in my keyring, e.g. to be able to decrypt old mails - maybe that was a bit confusing in my post yesterday). But I also have two keys where I have more than one mail address identity in it. I use these two keys for my company where I reply with different mail addresses which depends on the case why I get/send a mail (customerservice@, postmaster@, msebald@ ...).

I think the easiest way to really bind a key to a mail address and/or identity in K-9 is to use the key id. The id will never change - even if I add or change the key later. No idea if this way is more complicated to implement, but it would be great to have it that way. I know this from Thunderbird (Enigmail addon) where I can manually set a key for an identity (if not, Enigmail will guess by the sender mail address which key to use).

Sure, using an automatic procedure makes it more easy for users and maybe also to implement this into K-9, but it will only work for simple setups. My guess is that people who use PGP will not have a simple setup in most cases, unfortunally.

MarcusWolschon commented 8 years ago

So:

default key: There already is a default identity and thus a default key (if the user has chosen one).

choosing by KeyID instead of email address: Choosing a KeyID instead of an email that identifies a key gets rid of serveral issue. Most of all key-rollover, where you have an old key and a new one associated with one email address.

msebald commented 8 years ago

I was able to setup two identities with the same sender address with the newest alpha version 5.108 - I was surprised as this was not working before. So either it is an accident or a new feature.

So, setting a key id per identity is for sending, right? Then everything is set and ready to go. When receiving or opening old mails the key is chosen by the information from the mail - I would guess. Then also old key ids would taken from the private keyring?

yuv commented 8 years ago

@msebald: The subject of this bug report is sending, not receiving. The logic by which a key is chosen when receiving or opening old mails is surely important and you may want to open a different feature request if there is an issue in that area.

@MarcusWolschon: Yes, I believe that your data structure of one keyID for each K9-Identity is the simplest and easiest way to satisfy all reasonable use cases expressed in this thread.

The UI logic can and should IMHO follow @philipwhiuk principle of not over-complicating things, so compared to the K9 version that is currently on my phone via F-Droid.

Settings:

(1) Move the Cryptography setting from Account settings to Account settings > Sending mail > Manage identities > %K9-Identity%

(2) Replace Auto-sign boolean setting with a Signature setting that has the following choices:

(3) Account settings > Sending mail: add an "Always show cryptography" Boolean similar to the existing Always show Cc/Bcc, Off by default

Compose:

(1) Default, when Always show cryptography is off, use opportunistic mode, i.e. automatically sign if a keyID exists for the selected K9-Identity

(2) When Always show cryptography is on, show the current UI line with the two check boxes for Sign and Encrypt

That would be sufficient for the signing function, i.e. for the subject of the current feature request. It would leave some analysis and logic gaps for the encrypt function:

(1+) when using opportunistic mode, for each recipient: (a) if there is no key for the recipient in the key ring, don't encrypt (b) if there is a single key for the recipient in the key ring, encrypt (c) if there is more than a single key for the recipient in the key ring, ask which one to use

(2+) when in manual mode: show the current UI line and if the Encrypt check box is checked at the time of sending, follow the same logic as in (1+)


I believe the above reduces complexity for all users while increasing flexibility for the more sophisticated scenarios, and is described in sufficient detail to start implementation.

If somebody can point me to the actual files and line numbers in the code where this happen, I may spare some time and make my first attempt at patching an Android app.

philipwhiuk commented 8 years ago

Much of this has changed in the current beta/dev. The auto-sign/auto-encrypt setting doesn't exist any more. There's a padlock dialog which is displayed in the compose view if an app and key is setup, which defaults to opportunistic: https://github.com/k9mail/k-9/wiki/Crypto-Design-Thoughts

Right now the key is selected on an account basis in activity/setup/AccountSettings using an OpenPgpKeyPreference.

For it to be identity based means adding new settings to activity/EditIdentity.

For composing this means the RecipientPresenter (which should really be renamed now it does more than present recipients...) uses the key to set the availability of cryptography.

yuv commented 8 years ago

@philipwhiuk I don't have much time now nor in the next 14 days to look at things in detail. However, I must remark that the link in your comment above describes received emails while this feature request is about sending emails. I fail to see how the Crypto Design Thoughts linked above are relevant in the context of this feature request and I strongly recommend keeping the analysis and design of receiving and sending crypto function separated, if only for one major difference: I cannot control what I receive, but I can control what I send and how I send it.

philipwhiuk commented 8 years ago

I forgot it only covered received icons when I wrote that. My point was the UI has changed somewhat. Here's screenshots from the beta.

In any case @Valodim is spearheading the PGP/MIME project. I'm mostly bug-fixing right now.

image

image

yuv commented 8 years ago

Thanks for the screenshots. I assume that if I tap on the padlock icon next to the From line on the first screen shot, the dialog in the second screen shot. I assume that the dialog offers me four choices (sliding from left to right along the four icons), although from the look of it there could be six options if I am to tap on the text too.

If I have four choices on that dialog, what do they stand for?

I venture on thin ice with the following remarks, mainly because I have only partial information. It seems to me that whoever has designed / coded the screenshots and functionality (is it you, @philipwhiuk ?) has mixed together two crypt function: signature and encryption.

Signature:

Crypt:

I strongly advise clarity and separation between Crypt for Sending (Sign/Encrypt) and Crypt for Receiving (Verify/Decrypt).

To the specific dialog, if the options are really four different ones on a line, I would suggest removing the passive text header and indeed letting the user choose with a four position slider. However, if the four options are just the result of a combination of two binary choices, the slider is the wrong visual metaphore to use. A better one would be two toggles. Two icons, one for Sign and one for Encrypt. Gray = off, Colored = on. And I would use Black as a color, not Green, because the dialog is not indicating success, partial success, or failure (which would justify the use of Green/Yellow/Red), but just activation / deactivation. Moreover, the dialog is just a mere overriding of a default choice, so please bring back the default choice in the settings.

Please correct me if I am mistaken.

philipwhiuk commented 8 years ago

Following discussion - there's a mailing list for all this.. @Valodim and @cketti and others did the implementation.

The four options are:

It's not binary. Encrypting without signing is not quite pointless, but not far off.

And implying they are separate is not useful either. E-mail is a two-way protocol - it's not helpful to ignore that the hard part of PGP is key distribution - failing to provide a signature for return mail would only worsen the problem.

As for default choice, I find myself disabling entirely it quite a bit right now - sending PGP data to people who don't have compatible clients and when adoption is so low is counter productive. I would rather have to turn it on than always turn it off. But we are miles off topic.

I recommend you install the beta if you want to feedback further - me reproducing it in screenshots is kind of labour intensive when it's an open program.

I hope we can now stick to the issue in this issue for this issue and raise other issues separately.

Valodim commented 8 years ago

Indeed, please don't derail our issues. We appreciate that you want to contribute your thoughts, but describing how the interface looks in the alpha we released in the play store is not a good use of our time.

deviantollam commented 7 years ago

i am not running an alpha, but rather the official release from the Google Play store. i just upgraded to version 5.201 this morning and this was the absolute first thing that i noticed.

i have only one mail account but 9 sender identities, 7 of which have their own PGP keys. i hate having to send out, say, business mail from a business identity but then it gets signed (or even encrypted as the case may be) as my personal (primary) identity. it's horribly unprofessional, and now i have to either dig out a prior version of k9mail from an Android backup or stop sending business mail from my phone until this gets fixed. :-(

MarcusWolschon commented 7 years ago

So do we have a concensus on how to implement signature keys per identity? Who can implement it? (I'm currently occupied with 3 other projects.)

deviantollam commented 7 years ago

@MarcusWolschon i will gladly offer up any bounty payment that you care to name if this gets handled, either by you or by anyone you can convince to fix it.

Setting signing/decrypting keys by Identity as opposed to by email address or any other strange designator would be the biggest thing preventing me from using the latest version of K-9 Mail.

(Then we can go about addressing all of the other weird UI changed that happened in the new milestone, hah!)

Seriously, I dug an old version out from my last phone backup and that's what I've got at the moment. And the device is constantly trying to get me to upgrade to the new version, which I have to keep preventing, since it breaks the entire way that email and signatures should be handled. :-(

Sorry for sounding so harsh. But seriously, this is something I would gladly do ANYTHING to encourage others to address.

Valodim commented 7 years ago

When you say you have one mail account buy 9 sender identities, do those identities have different mail addresses? Using different keys with the same mail address seems like a weird scenario to me, if that's what you're doing can you say what the idea is there?

deviantollam commented 7 years ago

I have three IMAP accounts configured in K-9 mail. Two of which basically never send/receive messages... they are used for shared message archiving or just keeping tabs on some company operations.

So, that basic overview could be thought of as...

IMAP #1 Personal (the EVERYTHING account)

IMAP #2 Stored Old Stuff (shared by some other folk with access to same account)

IMAP #3 Other Business That I No Longer Run

Now, as far as identities are concerned, this is how the structure looks...

IMAP #1 deviant@deviating.net (has PGP key #1, most used) steve@familydomain.com (has PGP key #2, used for family emailing) deviant@nonprofit.org (doesn't use PGP at all, no key) deviant@corporate.com (has PGP key #3, used for internal chatter) steve@corporate.com (has PGP key #4, used for client communication) whatever@otherdomain.com (for misc. whatnot, no PGP key at all) whatever@otherdomain.net (for misc. whatnot, no PGP key at all) whatever@otherdomain.cn (for misc. whatnot, no PGP key at all)

IMAP #2 bobby@tables.com (has PGP key #5, rarely used for anyything)

IMAP #3 steve@oldcompanythatnoonecaresabout.biz (no PGP)

... it is not feasible for me to split up all of those IMAP #1 identities. I send and receive and reply to and (most of all) file into folders all of that mail in a common-use fashion. And almost all of those sender identities are tied to forwarder addresses, so there's no fully-featured IMAP account by which I could send mail on a server somewhere logging in as steve@corporate.com, let's say.

So all of them are set up as sender identities under IMAP #1 and that works well.

The latest K-9 mail client, however, seems to want to insist on ONLY ever using PGP Key #1 for signing ANY messages. As you can imagine, if steve@corporate.com is sending email to a client, signing it with "Deviant's PGP key" is totally unprofessional.

(Not to mention that the whole UI is totally complicated and hard to follow anymore, with the colored padlocks and three dots and all that... it used to just be two simple checkboxes. Sign and Encrypt. It was totally unambiguous. Now we've got some slider-bar and colored dots and "always, sometimes, never" choices. Ugh.)

deviantollam commented 7 years ago

i see that @yuv is of the same mind that I am...

the slider is the wrong visual metaphore to use. A better one would be two toggles. Two icons, one for Sign and one for Encrypt. Gray = off, Colored = on. And I would use Black as a color, not Green, because the dialog is not indicating success, partial success, or failure (which would justify the use of Green/Yellow/Red), but just activation / deactivation. Moreover, the dialog is just a mere overriding of a default choice, so please bring back the default choice in the settings.

two separate toggles would be much clearer, not to mention it more closely parallels every other encrypted email client I've ever seen, all of which treat "Sign" and "Encrypt" as two distinct buttons/toggles.

Valodim commented 7 years ago

This issue is about identities, please keep on topic.

Thanks for your feedback on your identities use case, I'll get back to it later.

deviantollam commented 7 years ago

fair enough. thanks to you and @cketti for getting things implemented this far. I'd love to find that mailing list which @philipwhiuk described in order to converse further about the other topics. where is that?

looking forward to folk implementing the "sign by identity" as opposed to current "sign by IMAP account" since that will be such a huge win.

thank you to everyone who makes the K-9 client what it is. it's marvelous.

philipwhiuk commented 7 years ago

k-9-mail@googlegroups.com - User list

k-9-dev@googlegroups.com - Dev list

Valodim commented 7 years ago

Fwiw, the current implementation of key id choice is more of a simplest way to implement prototype. Similarly, it's pointless to have different providers per account :)

deviantollam commented 7 years ago

@Valodim when you say "it's pointless to have different providers per account" i'm not exactly sure what you mean. different email providers per IMAP account?

in my example list above, all of the various other identities are forward-only addresses that push through to my personal address (sometimes coming in with various PGP keys in use). then I use my configured sender identities to dispatch replies back according to whom the parties are expecting to hear from.

Valodim commented 7 years ago

Oh sorry, I meant crypto providers. In the ui it's "crypto app", which can currently be set per account :)

deviantollam commented 7 years ago

are there any other reliable crypto tools for Android besides OpenKeychain? ever since APG was phased out, transitioned to OpenKeychain, I've not been familiar with one that anyone recommends.

and, yes, i'd agree... that would be one extreme edge case. :-)

Valodim commented 7 years ago

There isn't :) anyways, I'm currently moving those settings around, will probably post a wip pr soon

ache commented 7 years ago

I suggest to add PGP key autochoosing based on current folder too. In most cases email/alias autochoosing will be enough, this is just for completeness, i.e. Work1 forlder and Work2 folder, with automatic per-folder email address choosing first which allows automatic per-email choosing of PGP key next. I agree that permanent (maybe per-folder) remembering of always encrypt and only sign will be nice too.

Valodim commented 7 years ago

Folders don't really have any information to associate them with public keys, what would the choice be based on? Can you describe your use case?

I'm not a fan of "just for completeness" arguments at all - see also "feature creep".

ache commented 7 years ago

Folders don't really have any information to associate them with public keys, what would the choice be based on? Can you describe your use case?

I mean the folder where you currently stay with the list of incoming messages on the screen. As I suggest, to implement it, association folder = email should be implemented first, then association email = PGP key and always encrypt/only sign could be implemented to finalize this feature.

ache commented 7 years ago

BTW, this is implemented in Thunderbird with "Enigmail" (PGP stuff) + "Folder account" (assign identity to the folder) addons.

ArchangeGabriel commented 7 years ago

@ache What is wrong with having to select the sender identity amongst the list? Do you really have that many identities for this to be an issue? Also, given the practicality of navigating within folders on mobile vs. desktop, I don’t think this is an use case…

Valodim commented 7 years ago

Changing identities based on folder is unrelated to this issue. Please keep on topic.

ache commented 7 years ago

@ArchangeGabriel

What is wrong with having to select the sender identity amongst the list?

It is bothering operation, and user always need to remember which key it must choose. Mistake probability here is high.

Do you really have that many identities for this to be an issue?

Yes, I have several jobs and different PGP keys for each one.

ArchangeGabriel commented 7 years ago

@ache Let’s continue this discussion on https://github.com/k9mail/k-9/issues/2155.

ache commented 7 years ago

@Valodim

Changing identities based on folder is unrelated to this issue. Please keep on topic.

But implementing of changing PGP keys based on folder is related. Of course, you can implement per-folder PGP key without per-folder identities, but it will be more work, better use already suggested here per-email PGP keys choosing.

@ArchangeGabriel

Let’s continue this discussion on #2155.

OK, I'll answer your questions there.

deviantollam commented 7 years ago

it's been almost 6 months. where is the fix for this issue?

i am STILL religiously updating K-9 every time a new version comes out in the hopes that someone will correct this problem.

at it currently stands, i can go into my Cryptography settings and select "my key" (forcibly having to choose ONLY ONE SINGLE key out of my half-dozen private keys) and then when composing an email i have NO WAY to select another key, it seems. :-(

If I am writing a business email to a business client, i do NOT want to sign it with the key for deviant@deviating.net but i want to (naturally) sign it with the key for steve@professionalbusiness.com

Valodim commented 7 years ago

I finally have a concept for this issue and started working on this, so this is now in the more immediate pipeline. Yay.

sylph1o commented 5 years ago

Hi ! Is this still being considered? I don't wish to press, I'm simply very interested in this feature. If no one has time to work on it any more, I'll simply look for another solution. I don't have the skills to help, unfortunately =(.

CueHD commented 5 years ago

I also would appreciate being able to assign an openPGP key per identity. In addition being able to select from a list of OpenKeychain private keys instead of relying on the autoassignment is needed. Currently when I try to assign a key, the key that I want to use is not listed. While I am able to go to OpenKeychain from the dialog, I do not see any way to actually select my key. I hesitate to sumbit a bug report since I would rather that this gets fixed when implementing per identity key instead of per account key.

My use case is different than the ones already described, so I will state it here: My email provider (Fastmail) allows for unlimited identities. This is accomplished by using subadsressing. For example, an alias is emailaddress@domain.TLD. I am able to send and receive email using anything@emailaddress.domain.TLD. I use this often though I do not want to add every possible email address to my key. I prefer to use one key for all of these email addresses.