I am trying to better understand the processes involved in e2ee using WebCrypto on the browser. I understand that the only real method to use a passphrase to generate a symmetric key on the browser is using PBKDF2 using a crypto random salt and a number of iterations. This generates the key that will be used in the encrypt and decrypt function of WebCrypto along with a crypto random IV.

First question is OWASP recommends 310.000 iterations (not sure for what kind of passphrase though) so generating the key can take some time. Can this key be reused to encrypt different plaintexts or a new key with a new salt has to be generated for each message (i.e. calling deriveKey again)? Also about the iterations, if a passphrase with high enough entropy (say 5 6-letter words from the diceware wordlist) how does that affect the iteration requirements?

Secondly if the key can be reused, thus the same salt has been used for multiple messages (or all?) can this be saved along with the passphrase (or the encrypted messages?) and reused to re-generate the key and decrypt the messages. And do I have to re-generate the key or can I export/import it using WebCrypto's function instead?

So summarising, I understand that a different IV has to be used for each encryption, just not sure about the derived key and its salt, do these have to be different also?


You must log in to answer this question.

Browse other questions tagged .