Code Monkey home page Code Monkey logo

Comments (2)

DenBond7 avatar DenBond7 commented on July 24, 2024

The current logic:

  1. We load MIME message to store locally
  2. We encrypt the given input stream using KeyStoreCryptoManager(it uses Android Keystore). The last one uses AES/CBC/PKCS7Padding to encrypt the given input stream via CipherOutputStream. I didn't investigate performance at this point yet.
  3. Later we open a locally saved MIME message(that was encrypted). For that, we use KeyStoreCryptoManager and CipherInputStream. And at this stage we have a performance issue. For example, on my device(not cheap) decryption of 19Mb(a large message with attachments. For example sent by FES) takes around 40 seconds. Slower devices have a worse situation. CipherInputStream is a reason. It has a very bad performance, ref 2.

So after some research, I decided to use PGPailnless in combination with KeyStoreCryptoManager

A new logic will look:

  1. When a user adds a new account we create a random passphrase(PGP_PASS) via UUID.randomUUID()(it uses SecureRandom) and EC(curve25519) PGP private key(PGP_KEY) ecnrypted by this passphrase.
  2. We encrypt the passphrase and private key by KeyStoreCryptoManager(Android Keystore) and save them in the local database in the account settings.
  3. After that we use PGP_PASS and PGP_KEY to store a MIME message locally and read it.
  4. These changes does great performance improvements. On my device decryption of 19Mb(a large message with attachments. For example sent by FES) takes around 3-4 seconds.

in short: instead of using Android Keystore to encrypt/decrypt a MIME message to work with them locally we will use Android Keystore to decrypt/encrypt PGP_PASS and PGP_KEY, and use them to encrypt/decrypt a MIME message to work with them locally.

@tomholub What do you think?

from flowcrypt-android.

DenBond7 avatar DenBond7 commented on July 24, 2024
  • test migration from 1.4.8 to 1.4.9

from flowcrypt-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.