Closed tamf closed 3 years ago
use AES? https://stackoverflow.com/questions/29584051/javascript-encrypt-form-before-sending-with-aes
Some browsers have limitations in generating random numbers. Don't use Math.random for anything cryptography related https://security.stackexchange.com/questions/194107/should-i-encrypt-sensitive-form-data-with-javascript-on-the-client
https://bitwiseshiftleft.github.io/sjcl/ https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API/ If we can't trust the server at all, then client-side encryption is useless because the server serves the client page. https://security.stackexchange.com/questions/51703/how-to-best-use-javascript-to-encrypt-client-side-so-the-server-never-sees-it
Bitwarden uses AES-CBC to encrypt Vault data. PBKDF2 SHA-256 is used to derive the encryption key from a given passphrase. https://bitwarden.com/help/article/what-encryption-is-used/ Bitwarden uses Web Crypto.
Lastpass also uses AES-256 CBC
OpenPGP is also an option https://github.com/jhaals/yopass https://github.com/openpgpjs/openpgpjs#browser-plain-files
Good workflow that we should consider following in principle
Why HTTPS is not enough https://tozny.com/blog/end-to-end-encryption-vs-https/
Use Web Crypto and libsodium https://share.labs.tozny.com/faq
in conclusion, let's use Web Crypto to do AES-CBC using the custom passphrase. If a custom passphrase isn't given then generate random 64 char passphrase and include it in the sharing link. At this time I don't see the point of generating hashes and storing the final hash on the server.
If I understand correctly, encryption and decryption is going to be applied at both client-side and server-side. In order to use AES, we need to generate a key, and use a cipher inorder to generate cipher text (encryption). Does the key get transmitted to the server-side (and client-side in order to work in different sessions) along with the cipher text?
Encryption and decryption will be done only client side. For now, the server will not apply additional encryption for data at rest (in Firestore)
The key is not sent to the server. Only the cipher text is sent to the server. The user will be given a url which would encode the salt and secret id. If no passphrase is provided maybe the url would simply include the key and id
The secret should be encrypted in the client (front-end) before sending to the function