Web Crypto·续

Parameters

  • algorithmobject
  • Describes the algorithm to be used, including any required parameters, in an algorithm-specific format ↗︎.
  • baseKeyCryptoKey
  • lengthint
  • Length of the bit string to derive.

importKey

  • importKey(format, keyData, algorithm, extractable, keyUsages) : Promise\<CryptoKey>
  • Transform a key from some external, portable format into a CryptoKey for use with the Web Crypto API.

Parameters

exportKey

  • exportKey(formatstring, keyCryptoKey) : Promise\<ArrayBuffer>
  • Transform a CryptoKey into a portable format, if the CryptoKey is extractable.

Parameters

wrapKey

  • wrapKey(format, key, wrappingKey, wrapAlgo) : Promise\<ArrayBuffer>
  • Transform a CryptoKey into a portable format, and then encrypt it with another key. This renders the CryptoKey suitable for storage or transmission in untrusted environments.

Parameters

unwrapKey

  • unwrapKey(format, key, unwrappingKey, unwrapAlgo,  unwrappedKeyAlgo, extractable, keyUsages) : Promise\<CryptoKey>
  • Transform a key that was wrapped by wrapKey() back into a CryptoKey.

Parameters

timingSafeEqual

  • timingSafeEqual(a, b) : bool
  • Compare two buffers in a way that is resistant to timing attacks. This is a non-standard extension to the Web Crypto API.

Parameters

  • aArrayBuffer | TypedArray
  • bArrayBuffer | TypedArray

Supported algorithms

Workers implements all operations of the WebCrypto standard ↗︎, as shown in the following table.

A checkmark (✓) indicates that this feature is believed to be fully supported according to the spec.
An x (✘) indicates that this feature is part of the specification but not implemented.
If a feature only implements the operation partially, details are listed.

Algorithm sign()<br>verify() encrypt()<br>decrypt() digest() deriveBits()<br>deriveKey() generateKey() wrapKey()<br>unwrapKey() exportKey() importKey()
RSASSA PKCS1 v1.5 ✓ ✓ ✓ ✓
RSA PSS ✓ ✓ ✓ ✓
RSA OAEP ✓ ✓ ✓ ✓ ✓
ECDSA ✓ ✓ ✓ ✓
ECDH ✓ ✓ ✓ ✓
Ed25519<sup>1</sup> ✓ ✓ ✓ ✓
X25519<sup>1</sup> ✓ ✓ ✓ ✓
NODE ED25519<sup>2</sup> ✓ ✓ ✓ ✓
AES CTR ✓ ✓ ✓ ✓ ✓
AES CBC ✓ ✓ ✓ ✓ ✓
AES GCM ✓ ✓ ✓ ✓ ✓
AES KW ✓ ✓ ✓ ✓
HMAC ✓ ✓ ✓ ✓
SHA 1 ✓
SHA 256 ✓
SHA 384 ✓
SHA 512 ✓
MD5<sup>3</sup> ✓
HKDF ✓ ✓
PBKDF2 ✓ ✓

Footnotes:

  1. Algorithms as specified in the Secure Curves API ↗︎.
  2. Legacy non-standard EdDSA is supported for the Ed25519 curve in addition to the Secure Curves version. Since this algorithm is non-standard, note the following while using it:
  3. Use NODE-ED25519 as the algorithm and namedCurve parameters.
  4. Unlike NodeJS, Cloudflare will not support raw import of private keys.
  5. The algorithm implementation may change over time. While Cloudflare cannot guarantee it at this time, Cloudflare will strive to maintain backward compatibility and compatibility with NodeJS's behavior. Any notable compatibility notes will be communicated in release notes and via this developer documentation.
  6. 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 algorithm. Do not rely upon MD5 for security.

Modern algorithms

The webcrypto_modern_algorithms compatibility flag enables a subset of the evolving Modern Algorithms in the Web Cryptography API ↗︎ draft.

Algorithm sign()<br>verify() encapsulateKey()<br>encapsulateBits()<br>decapsulateKey()<br>decapsulateBits() generateKey() exportKey() importKey()
ML-DSA-44, ML-DSA-65, and ML-DSA-87 ✓ ✓ ✓ ✓
ML-KEM-768 and ML-KEM-1024 ✓ ✓ ✓ ✓
ML-KEM-512 ✘ ✘ ✘ ✘

The flag also adds getPublicKey() and SubtleCrypto.supports(). It supports JSON Web Keys (JWKs) with the AKP key type.

Workers does not implement other algorithms from the draft. This API may change as the draft evolves.


Was this helpful?

YesNo

On this page

Web Crypto·续 - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#page","headline":"Web Crypto","description":"A set of low-level functions for common cryptographic tasks.","url":"https://developers.cloudflare.com/workers/runtime-apis/web-crypto/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/runtime-apis/web-crypto/og.png?v=6ad0cbc1a2ead550","dateModified":"2026-09-30","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Standardized APIs for use by Workers running on Cloudflare's global network. title: Web standards image: https://developers.cloudflare.com/workers/runtime-apis/web-standards/og.png?v=be37c9dac9250fd5


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers/llms.txt
Use this file to discover all available pages before exploring further.