-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Currently, the produced encrypted output includes only the IV, MAC and Ciphertext.
Consider adding a leading byte (packed) which indicates an algorithm version indicator. This will allow upgrades to the algorithm to be detected.
Example: currently, you are using aes-256-ctr-hmac-sha256. But if you want to upgrade to SHA3 at some point, or switch ciphers (due to a flaw, or what have you), you're SOL.
Additionally, fixing crypto weaknesses will be a significant challenge.
So, I would suggest adding a single leading byte to the output, which indicates which of your algorithms you're using.
That way, decrypt needs to handle all of the algorithms (which it can detect since it has the leading byte), but encrypt only needs to support the most recent one.