Dodging Web Crypto API Landmines
summary
Practical guide to browser crypto that shows working code paths: use AES-GCM with a 256-bit key and 12‑byte IV, derive that key from a password with PBKDF2 with SHA‑256 and a 32‑byte salt, generate salt/IV with crypto.getRandomValues, and bundle salt+IV+ciphertext (base64) for storage. Measurements: native PBKDF2 at ~25k–200k iterations is ~100 ms on laptop, AES encrypt 1 KB <0.5 ms; polyfills and mobile are slower. Caveats: feature detection is trial-and-error, Edge/IE gaps, and no password reset.
AI-written summary · about
chapters (15)
- 0:00Introduction to Web Crypto
- 1:06Why use browser crypto
- 2:51Subtle Crypto API overview
- 5:19Typed arrays for binary data
- 7:46Understanding crypto keys
- 9:31AES-GCM encryption basics
- 11:19PBKDF2 key derivation
- 13:26Browser support and polyfills
- 13:48Encryption workflow example
- 23:21Decryption workflow example
- 25:49Critical implementation notes
- 27:35Polyfill options and limitations
- 28:18Performance benchmarks
- 30:23Web workers for efficiency
- 31:47Q&A session
