Web Crypto

The Web Crypto API provides a set of low-level functions for common cryptographic tasks. The Workers Runtime implements the full surface of this API, but with some differences in the supported algorithms compared to those implemented in most browsers. This API is commonly used for signing requests

Functions

SubtleCrypto

Accessible from crypto.subtle.

Methods

Implements the full API described here.

Supported Algorithms

Cloudflare implements a subset of the most common crytographic algorithms, as shown in the following table. We are happy to add support for more algorithms – let us know.

Algorithm sign()
verify()
encrypt()
decrypt()
digest() deriveBits()
deriveKey()
generateKey() wrapKey()
unwrapKey()
RSASSA-PKCS1-v1_5
ECDSA
HMAC
AES-CBC
AES-GCM
SHA-1
SHA-256
SHA-384
SHA-512
MD5*1
PBKDF2

1 MD5 is not part of the WebCrypto standard, but is supported in Cloudflare Workers for interacting with legacy systems that require MD5. MD5 is considered a weak standard. Do not rely upon MD5 for security.