Closed Bug 1599233 Opened 5 years ago Closed 5 years ago

Protect keyring using an automatic password that's protected with the master password

Categories

(MailNews Core :: Security: OpenPGP, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 72.0

People

(Reporter: KaiE, Assigned: KaiE)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

In the interest of simplicity, we want to allow the user to not manage passphrases for OpenPGP keys that are managed by Thunderbird.

However, if the user decides to set a master password for Thunderbird, then the openpgp keys should be protected by it, too.

This could be implemented using the following approach, which has been suggested and implemented by Vincent Breitmoser in an autocrypt addon. Because the code is MPL 2, I'd like to reuse it.

The above implementation works like this:

  • Thunderbird obtains 16 random bytes, and converts it to a hex string of 32 chars
  • this string is used as the passphrase for all OpenPGP keys managed by Thunderbird
  • that string is remembered as a "saved login"

Whenever Thunderbird creates or imports an OpenPGP key, it will protect it using that automatic passphrase.

As a result, the OpenPGP keys that are stored on disk will be protected with that passphrase. By default. the passphrase can be obtained in a trivial way, by opening the saved password user interface, or by using the symmetric key stored in the NSS database.

However, as soon as the user sets a master password, obtaining the openpgp passphrase will require to provide the master password. This is equivalent to the protection for saved logins, and for the private keys of S/MIME certificates.

In the initial implementation, nothing protects the user from deleting it from the list of saved logins, which will cause all saved openpgp keys to be unusable. We should add some protection mechanism, but that should be handled at a later time, in a follow up bug.

Import Vincent Breitmoser's code to automatically create and keep a password for protecting openpgp keys. Some identifiers have been renamed.

Assignee: nobody → kaie

This patch is on top of bug 1598478 and achieves the following:

  • it removes the passphrase controls from key generation UI
  • it adds a key provider for RNP to always use this passphrase

I've tested that the following works:

  • create an RSA key in TB
  • use RNP command line tools to export the public key
  • import the public into classic TB+Enigmail
  • send an encrypted mail
  • read the mail using TB 72 + RNP

Message is successfully decrypted.
I verified using RNP command line tools that the automatic passphrase is required to use the openpgp key stored in the thunderbird profile.

Attachment #9111377 - Flags: review?(patrick)
Attachment #9111375 - Flags: review?(patrick)
Blocks: 1595230
Comment on attachment 9111375 [details] [diff] [review]
1599233-import.patch

```
+ const random_bytes = new Uint8Array(32);
+ crypto.getRandomValues(random_bytes);
  etc.
```

You could just as well have used EnigmailRNG.getRandomString(numChars); it does the same thing a little easier.
Attachment #9111375 - Flags: review?(patrick) → review+
Attachment #9111377 - Flags: review?(patrick) → review+

(In reply to Patrick Brunschwig from comment #3)

You could just as well have used EnigmailRNG.getRandomString(numChars); it
does the same thing a little easier.

Thanks. That code was written by Vincent. I'll add a TODO comment with your suggestion.

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/01810b29d5ec
Import masterpass.jsm code from Valodim (Vincent Breitmoser). r=patrick DONTBUILD

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED

https://hg.mozilla.org/comm-central/rev/5629275db993
Protect keyring using an automatic password that's protected with the master password. r=patrick DONTBUILD

(please remember to set the target milestone for when it landed, pulsebot doesn't handle that for tb)

Target Milestone: --- → Thunderbird 72.0
See Also: → 1617446
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: