This project aims to enhance the performance of encryption in Joplin across all platforms.
The current encryption implementation in Joplin is based on sjcl
, which is a pure Javascript library without any performance optimization at the hardware level. By migrating to native crypto libraries, users can expect faster speeds and improved user experience, particularly on mobile platforms.
Project Goals
- Migrate to better encryption algorithms and faster/native crypto libraries
- Use AES-GCM mode.
- For desktop clients, use the crypto library in Node.js
- For mobile clients, find a faster and reliable React Native library with the support of AES-GCM mode.
- If no proper crypto library for React Native is found, implement the cipher with native code and create a React Native library as a wrapper for it.
- For Android: Use
javax.crypto
- For iOS: Use
Common Crypto
library orOpenSSL
- For Android: Use
- The key size could be 128, 192 or 256 bits, depending on the performance of the final implementation.
- Re-implement the encryption/decryption in
sjcl
with faster crypto libraries (optional)- Implement AES-CCM mode.
- For desktop clients, use the crypto library in Node.js
For mobile clients, find a faster and reliable React Native library with the support of AES-CCM mode.(We plan to usereact-native-quick-crypto
but the OpenSSL binaries in it don't support CCM mode)If no proper crypto library for React Native is found, implement the cipher with native code and create a React Native library as a wrapper for it.For Android: Use(Doesn't support CCM mode)javax.crypto
- For iOS: Use
OpenSSL
- Reduce the size of encrypted notes (optional)
- Investigate if it's possible to save the encrypted notes in binary format rather than base64 encoded text.
- Implement some of the encryption/decryption code in the native layer, to avoid using the asynchronous bridge on the raw bytes.
- Wait for the release of React Native with Fast JavaScript/Native Interfacing (requires React Native's New Architecture)
- Refactor
EncryptionService
and related code in Joplin, to support encrypted notes with binary format. - Use the low-level encrypt/decrypt function in
sjcl
library to test the refactoredEncryptionService
. - Replace
sjcl
with the crypto libraries in Goal #1
- Investigate if it's possible to save the encrypted notes in binary format rather than base64 encoded text.
Note: These goals don't come in a specific order. I might process them in parallel and evaluate if the optional goals are feasible based on the progress.