thunderbird / thunderbird-android

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

try to lookup pgp-keys when sending new email #1760

Open zoff99 opened 7 years ago

zoff99 commented 7 years ago

Expected behavior

write new email to "sender" when pgp provider like openkeychains is active, k-9 should ask openkeyschain to lookup "sender" and check if there is a key stored online. if yes -> download key and use it if no -> just send email normally

Actual behavior

write new email to "sender" emails is just signed (k-9 does not check if a key for "sender" can be found online)

Steps to reproduce

see above

Environment

K-9 Mail version: 5.114 (f-droid)

Android version: 6.x

Account type (IMAP, POP3, WebDAV/Exchange): IMAP

philipwhiuk commented 7 years ago

I think we just pass off to OpenKeychain to determine whether there is a key available. So this may actually be first a change to OpenKeychain's behaviour to launch an intent suggesting searching online key repositories.

@dschuermann @Valodim what do you think?

zoff99 commented 7 years ago

it would be great if this would work as seemless as possible, to make more users transition to pgp encryption

zoff99 commented 7 years ago

the less user interaction is needed, the more widespread pgp will be used

Valodim commented 7 years ago

Firstly, the is the privacy issue of looking up keys potentially every time, when users write an email to an unknown address. Secondly, what do we do if there is multiple keys?

zoff99 commented 7 years ago

it should be the same as with receiving an encrypted email. openkeychains should automatically be opened if multiple keys are found

lbdroid commented 7 years ago

k9 already informs you about the existence of recipient public keys when adding the recipients to the message. I would suggest that when you click on the recipient showing the "no public keys" icon, it should provide an option to start the key obtaining process for that recipient with openkeychain.

zoff99 commented 7 years ago

it should be seamless to use for any user without any technical knowledge.

so when you have "encrypt if possible" set, it k-9 should actually check if encryption is possible, by using the pgp provider to get the keys needed. (call the same intent as when receiving an encrypted email where the key is not available)

why should the user take a sperate action, when "encrypt if possible" was already set?

the result now is that email is send unencrypted, but user has selected to encrypt.

lbdroid commented 7 years ago

No. It should only go get keys IF the user ACTUALLY tells it to.

User interaction IS MANDATORY in order for a key to be trusted. Without ACTUALLY taking manual steps to verify the key, no security is being added BY encrypting the message. You might as well send it plain text.

k9mail makes it VERY clear when the message will or will not be encrypted to all recipients. That is the appropriate opportunity to ALLOW the user to perform appropriate key management functions.

It should NEVER go out on the internet and find some random key to use to encrypt something.

Key verification requires an actual communication with the owner of the key, for instance, READING the fingerprint over a voice phone call, or in the very least, sharing the fingerprint over a different protocol. Without that, you DO NOT KNOW who generated the key.

philipwhiuk commented 7 years ago

User interaction IS MANDATORY in order for a key to be trusted.

FYI: None of the current internet crypto works like this. Frankly, this is a big part of why security doesn't get adopted.

In any case, prompting should be a decision taken by the PGP app - because the PGP app is where the security decisions are taken - and the trade off between convenience and validity can be made. This is an issue that can be debated on OKC's app as to whether a prompt for internet lookup is required (or perhaps configurable - 'lookup always, prompt, never'?)

It's not for K-9 to make decisions about key sources. We should fire an intent, OKC should display a prompt activity if required, do any lookups it wants to and then return us the keys for emails that are available). If that protocol needs to be changed to accommodate that prompt, that's something to look at.

zoff99 commented 7 years ago

@philipwhiuk yep, exactly what i mean. the pgp provider should take care of security, K-9 should fire an intent without any button presses from the user.

zoff99 commented 7 years ago

also it's clear because: you have 1 pgp-provider app, and many apps that use pgp. so deceisions should be made at a single point, the pgp proverder app.

Valodim commented 7 years ago

I don't think it's that clear. There are use cases for pgp that do have very different requirements that lead to different trust models - think e-mail communication vs package signing.

Mid term I plan to have an inband-exchange of keys with a TOFU trust model that works with zero user interaction. I'm not sure yet where that information will be stored, and how it will look exactly though :)

zoff99 commented 7 years ago

i hope some version of that will make it into the next release. seemless pgp integration in k-9 (with openkeychains) would most likely boost pgp usage a lot.

whyteks commented 7 years ago

Wow.. I do think folks should be very careful with this. Don't spoil a good Email app by messing up the encryption. For social graph revealing apps we already have whatsapp. Some of the beauty of PGP is the fact that it is, because it's highly configurable, suitable to all use cases. Something probably Stallman would applaud. I'd love to ask him what he thinks of this recent developer attitude a la Valodmin, Moxie etc. but I'd rather not hang around for the answer. :) Out with the old.. Down with user decision making. Control them all!

zoff99 commented 7 years ago

you missunderstand. k-9 should pass it seamless to the pgp provider. the provider can show a popup to get the user consent (which openkeychains already does now). no need for the user to say "go" in k-9 and then say "go" again in openkeychains.

also most ordinary users will not even know of the existance of pgp keys for the other party. so if you write a new email and have set "encrypt if possible" then you already have stated your consent in a way. now on every new email k-9 should therefore ask openkeychains automatically if there is a key for the receipient email, of not there locally it should show a popup asking if a keys should be searched online.

and it's email so every time you write email you already leak lots of meta data, so asking a keyserver for the key is only a small amount more of that.

whyteks commented 7 years ago

You know, I think this is all down to configurable options. Everything is fine as long as the user has a choice about the behaviour. When you lock stuff down there will always be a use case you don't support. You can say that's not a valid use case, but the beauty of open source thinking used to be total configurability by the end user. I guess re my previous comment, Stallman would just say "fork it". Actually he wouldn't have such a massive fail as an Android device in the first place. :)

I might like to have a default of "encrypt if possible", but not have to either: 1) click the icon move the slider 2) dismiss something in the pgp provider. rather, I might like k-9 to just send the mail. Maybe it's actually about getting the design right. I quite liked the easy access to the sign and encrypt check boxes before. Right now, it's annoying me to have to move the slider on every email that I'm not encrypting. But I believe that's fixed now in master. :) I will probably step back from posting on this now, as although I mean to be light hearted, I fear I may offend someone. Anyway, I'd prefer to contribute code rather than comments, but there's only so many hours in the day, and I haven't looked at Android development in well over a year.

Valodim commented 7 years ago

re configurable: I no longer agree that configurability and empowering the user to do what they want is a reasonable prime directive, particularly not in crypto, and particularly not if it means to support every conceivable way of twisting the openpgp data format into workflows that make no sense on a larger scale. See also: misfeatures, feature creep, bloat. We'll always be totally configurable in the Apache 2.0 sense though :)

Your complaint relates to #1790, and should be fixed there.

If you'd like to contribute code, we'd be happy to have you. How about that message source display activity or image attachment resizing? Or if you prefer bug hunting, we have tons of those. Drop by the irc/matrix channel if you want real time guidance :)

(other than that - back to topic please:)

I might make the locks in the dropdown list clickable to allow searching for keys. But that's not really a solution I'm 100% happy with, so it's sort of a backburner thing at the moment (since searching for keys on keyservers is a workflow I'm not very fond of)

zoff99 commented 7 years ago

"forking" or "options" will have the effect that ordinary users can not use pgp. k-9 has the chance to widen pgp usage (just look at the download numbers in playstore). so some good default settings are essential.