Sharing a notebook with E2EE enabled
- When sharing the notebook, a key (NOTEBOOK_KEY) is automatically generated and encrypted with the sender master password.
- That key ID is then associated with the notebook
- When adding a recipient, the key is decrypted using the sender master password, and reencrypted using the recipient public key
- That encrypted key is then attached to the share_user object (the invitation)
- When the recipient receives the invitation, the key is retrieved from it, then decrypted using the private key, and reencrypted using the recipient master password.
Once the key exchange is done, each user has their own copy of NOTEBOOK_KEY encrypted with their own master password. Public/Private Keys are only used to transfer NOTEBOOK_KEY.
Whenever any item within the notebook is encrypted, it is done with NOTEBOOK_KEY.
Active attacker
The above public key encryption process defends against an honest-but-curious server (passive attacker). It does not defend against an active attacker able to replace recipient public keys with custom public keys.
To defend against an active attacker, users must manually validate recipient public keys using an out-of-band channel. Joplin's share dialog includes a 🔑 button, which shows a SHA256 hash of the recipient's public key. This hash is described as the "public key fingerprint" in Joplin's settings.
In the share dialog, a checkmark is shown next to the 🔑 icon if the public key from the server matches the last-confirmed public key.
Migrations
Enabling migration to a new public key algorithm can be done by:
- Registering a new public key algorithm. This involves:
- Adding a new item to the
PublicKeyAlgorithmenumand - Updating the
PublicKeyCryptoProviderfor each platform.
- Adding a new item to the
- Adding the new
PublicKeyAlgorithmenum item to theppkMigrationsarray inppk.ts.