PGP Tool

This is the way I learnt to understand openpgpjs. I did one small step after the other, that's wha there are so many files and options:

System 1

System 2


Working system - to integrate

This is what I suggest to integrate:

Deterministic Encryption 4.0: It generates a key pair. The secret key is encrypted with the passphrase. The seret key is then encrypted with AIS, for key and IV we use the email address (see code). The AES-encrypted private key is then stored in the local indexeddb (in the local browser) and uploaded to the server where is's stored in mySQL.

Login 3.0 & Encrypt 2.0: Login (without user password - just for simulation). It then loads the AES-encrypted private key from the server and saves it in the local indexeddb (in the local browser). After entering the passphrase, the key is AES-decrypted. Then the key (which is still PGP-encrypted with the prassphras) is decrypted with the passphrase. The decrypted version of the key (dangerous - with this you can decrypt without passphrase!) is only stored in a local JS variable.
When encrypting a message, the indexeddb is checked for a matching public key. In case there is no matching public key of the recipient, the server is checked. In case the server has the public is, it is send to encrypt the message.
The system also has an auto-logout function, activated after one minute of no user action (no mouse movement, no clicks).

Debug