Web Crypto API
Pronunciation: WEHB KRIP-toh A-P-I
Definition
The Web Crypto API provides browser and web-worker interfaces for cryptographic operations such as randomness, hashing, encryption, signatures, and key handling. Web Crypto API must define the principal, credential or key material, permitted scope, environment, transport, verification rules, expiry, rotation, revocation, and audit evidence.
Overview
Meaning and scope
The Web Crypto API provides browser and web-worker interfaces for cryptographic operations such as randomness, hashing, encryption, signatures, and key handling. Web Crypto API must define the principal, credential or key material, permitted scope, environment, transport, verification rules, expiry, rotation, revocation, and audit evidence.
Mechanism and operation
Web Crypto API participates in issuance, storage, presentation, verification, authorization, rotation, revocation, and investigation. The API is intentionally low-level and easy to misuse through wrong algorithms, modes, nonces, encodings, or key lifecycle. Browser storage and JavaScript supply chains remain part of the security boundary. The Web Crypto API contract should define identifiers, validation, authorization, status semantics, errors, limits, and version behavior at the same boundary. Secure use of Web Crypto API keeps secrets outside client code and logs, applies least privilege, prevents replay where needed, monitors anomalies, and separates authentication from authorization. Developers should use reviewed protocols, cryptographically secure randomness, authenticated encryption, correct nonce rules, and non-exportable keys where appropriate.
Practical payment example
A browser creates a non-exportable cryptographic key through the Web Crypto API for local authentication. Developers do not assume that browser key storage automatically supplies hardware-wallet custody or blockchain transaction signing.
Operational checks
Cross-site scripting can call cryptographic operations in the user’s session. Strong content security policy, dependency control, origin security, test vectors, and server-side authorization remain necessary. An audit trail for Web Crypto API should link the contract and client version, principal, request identifier, sanitized payload evidence, response, callbacks, retries, overrides, provider references, and final state.
Distinctions and limits
Its SubtleCrypto interface uses standardized algorithms and key objects rather than exposing raw implementation details. Web Crypto provides strong primitives, not safe protocols; algorithm choices, key lifecycle, origin security, and application design determine protection.
Related reading
Related definitions: authenticated encryption, content security policy.
Example
A browser creates a non-exportable cryptographic key through the Web Crypto API for local authentication. Developers do not assume that browser key storage automatically supplies hardware-wallet custody or blockchain transaction signing.
Comparison
Its SubtleCrypto interface uses standardized algorithms and key objects rather than exposing raw implementation details.
Key Takeaway
Web Crypto provides strong primitives, not safe protocols; algorithm choices, key lifecycle, origin security, and application design determine protection.
Sources
- NIST Documentation: Cryptographic Standards And Guidelines — NIST (2026-07-30)
- IETF RFC 9110 — IETF (2026-07-30)
- OpenAPI Initiative Documentation: V3.2.0 — OpenAPI Initiative (2026-07-30)