Re:Password protect a static HTML page
by tptacek on Saturday February 18, 2023 @01:53PM
(#34849824)
I don't know what "being a stream" has to do with anything (you should virtually always use "stream" modes of AES); the meaningful distinction between CBC and GCM is that GCM authenticates the ciphertext, so you can't tamper with it.
[ Parent
| on HN ]
Re:Password protect a static HTML page
by tialaramex on Saturday February 18, 2023 @02:14PM
(#34850055)
> so you can't tamper with it.
... if the API provided is correctly designed, and either the language made it practical to design the API in a misuse-resistant way /or/ the programmer was actually careful and used it properly.
We both know it's way more likely the problem in your actual system is "Oops, we use the bogus plaintext here despite the validation error" than "Dastardly enemy cryptographers have made a breakthrough in cryptanalysis to attack our product".
Re:Password protect a static HTML page
by tptacek on Saturday February 18, 2023 @02:15PM
(#34850067)
I'm not thinking very hard about it; there is just never a reason to use unauthenticated encryption modes. When I wrote that comment, I hadn't even looked to see if they'd manually authenticated their ciphertext (spoiler alert: you can guess).
Re:Password protect a static HTML page
by ThePhysicist on Saturday February 18, 2023 @04:22PM
(#34851235)
SubtleCrypto (Web Cryptography API) will simply throw an exception if the authentication fails for AES-GCM, so there's no way to even get at the bogus plaintext.
Also I checked the code quickly, they do Cbc-hmac, and they check the Mac before decrypting so it seems fine.
The 1000 rounds only of pbkdf2 on something that's essentially going to be available without any access control (since the encryption is the access control here) might be more annoying as the password can be human generated.