Web Cryptography API Examples
github.com
github.com
* Never use RSA PKCS1v15
* Avoid padding arbitrary data to RSA-OAEP encryption (you only ever want to encrypt keys)
* The "nonce" bits of the AES-CTR must be random, but the API doesn't even make it obvious which bits those are. Screw that up and you get no security.
* Avoid AES-CBC.
* You can't securely use AES-CBC or AES-CTR without a MAC.
* Never, ever use AES-CFB.
* Avoid multiplicative group DH (what WebCrypto calls "DH").
Out of all those examples, the only interfaces that approach "safe" are AES-GCM and AES-CMAC, and even the AES-GCM case makes it awfully easy to repeat the nonce, which is a devastating vulnerability.
As I understand it, whatever HN might want to believe this API is for, its real purpose is to make it possible to implement DRM without plugins. It's a compat interface, and it shows.
Huh? This is not an IV, the only hard requirement is that it be unique. What am I missing?
The interface is still treacherous!
This is pretty terrible.
If anyone was looking forward to using this for creating browser extensions (do NOT deliver code from a webserver and assume it's safe!), you're better off using https://github.com/jedisct1/libsodium.js instead.
Why? Most of the flaws comes from MtE as I understand.
Those two issues pretty much disappear with the use of a built in api from the browser. I guess now you've just got to trust the browser, but the browser is never going to be as secure as doing things on your own server.