Web Crypto API algorithm identifiers
The crypto.subtle interface takes a named algorithm for every operation, and
each algorithm only supports certain operations. This reference lists the
SubtleCrypto algorithm identifiers with a support matrix across sign, verify,
encrypt, decrypt, digest, derive and wrap, plus a live filter.
How it works
Every SubtleCrypto call names an algorithm and supplies its parameters:
const sig = await crypto.subtle.sign(
{ name: "ECDSA", hash: "SHA-256" },
privateKey,
data
);
const ct = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
key,
plaintext
);
An algorithm only works for the operations it supports — AES-GCM does
encrypt/decrypt/wrapKey/unwrapKey but not sign; ECDSA does sign/verify but not
encrypt. The matrix below maps each name to its valid operations.
Tips and notes
- Prefer
AES-GCM(authenticated) overAES-CBCfor new code, with a unique IV. PBKDF2/HKDF/ECDHproduce key material viaderiveBits/deriveKeyonly.- Hash names (
SHA-256,SHA-384,SHA-512) are used withdigestand as thehashparameter inside signing/derivation algorithms. SHA-1is supported fordigestbut is unsafe for signatures.