11---
22pcx_content_type : configuration
3- title : Crypto
3+ title : crypto
44---
55
66import { Render } from " ~/components" ;
@@ -9,134 +9,13 @@ import { Render } from "~/components";
99
1010The ` node:crypto ` module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.
1111
12- A subset of the ` node:crypto ` module is available in Workers. All APIs in the tables below with a ✅ are supported, and unless otherwise noted, work the same way as the implementations in Node.js.
12+ All ` node:crypto ` APIs are fully supported in Workers with the following exceptions:
1313
14- The [ WebCrypto API] ( /workers/runtime-apis/web-crypto/ ) is also available within Cloudflare Workers.
14+ - The functions [ generateKeyPair] ( https://nodejs.org/api/crypto.html#cryptogeneratekeypairtype-options-callback ) and [ generateKeyPairSync] ( https://nodejs.org/api/crypto.html#cryptogeneratekeypairsynctype-options )
15+ do not support DSA or DH key pairs.
16+ - ` ed448 ` and ` x448 ` curves are not supported.
1517
16- ## Classes
18+ The full ` node:crypto ` API is documented in the [ Node.js documentation for ` node:crypto ` ] ( https://nodejs.org/api/crypto.html ) .
1719
18- | API | Supported? | Notes |
19- | --------------------------------------------------------------------------------- | ---------- | ----- |
20- | [ Certificate] ( https://nodejs.org/api/crypto.html#class-certificate ) | ✅ | |
21- | [ Cipher] ( https://nodejs.org/api/crypto.html#class-cipher ) | | |
22- | [ Decipher] ( https://nodejs.org/api/crypto.html#class-decipher ) | | |
23- | [ DiffieHellman] ( https://nodejs.org/api/crypto.html#class-diffiehellman ) | ✅ | |
24- | [ DiffieHellmanGroup] ( https://nodejs.org/api/crypto.html#class-diffiehellmangroup ) | ✅ | |
25- | [ ECDH] ( https://nodejs.org/api/crypto.html#class-ecdh ) | | |
26- | [ Hash] ( https://nodejs.org/api/crypto.html#class-hash ) | ✅ | |
27- | [ Hmac] ( https://nodejs.org/api/crypto.html#class-hmac ) | ✅ | |
28- | [ KeyObject] ( https://nodejs.org/api/crypto.html#class-keyobject ) | ✅ | |
29- | [ Sign] ( https://nodejs.org/api/crypto.html#class-sign ) | | |
30- | [ Verify] ( https://nodejs.org/api/crypto.html#class-verify ) | | |
31- | [ X509Certificate] ( https://nodejs.org/api/crypto.html#class-x509certificate ) | ✅ | |
32- | [ constants] ( https://nodejs.org/api/crypto.html#cryptoconstants ) | | |
33-
34- ## Primes
35-
36- | API | Supported? | Notes |
37- | -------------------------------------------------------------------------------------------- | ---------- | ----- |
38- | [ checkPrime] ( https://nodejs.org/api/crypto.html#cryptocheckprimecandidate-options-callback ) | ✅ | |
39- | [ checkPrimeSync] ( https://nodejs.org/api/crypto.html#cryptocheckprimesynccandidate-options ) | ✅ | |
40- | [ generatePrime] ( https://nodejs.org/api/crypto.html#cryptogenerateprimesize-options-callback ) | ✅ | |
41- | [ generatePrimeSync] ( https://nodejs.org/api/crypto.html#cryptogenerateprimesyncsize-options ) | ✅ | |
42-
43- ## Ciphers
44-
45- | API | Supported? | Notes |
46- | ----------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------ |
47- | [ createCipher] ( https://nodejs.org/api/crypto.html#cryptocreatecipheralgorithm-password-options ) | | Deprecated, use ` createCipheriv ` instead |
48- | [ createCipheriv] ( https://nodejs.org/api/crypto.html#cryptocreatecipherivalgorithm-key-iv-options ) | | |
49- | [ createDecipher] ( https://nodejs.org/api/crypto.html#cryptocreatedecipheralgorithm-password-options ) | | Deprecated, use ` createDecipheriv ` instead |
50- | [ createDecipheriv] ( https://nodejs.org/api/crypto.html#cryptocreatedecipherivalgorithm-key-iv-options ) | | |
51- | [ privateDecrypt] ( https://nodejs.org/api/crypto.html#cryptoprivatedecryptprivatekey-buffer ) | | |
52- | [ privateEncrypt] ( https://nodejs.org/api/crypto.html#cryptoprivateencryptprivatekey-buffer ) | | |
53- | [ publicDecrypt] ( https://nodejs.org/api/crypto.html#cryptopublicdecryptkey-buffer ) | | |
54- | [ publicEncrypt] ( https://nodejs.org/api/crypto.html#cryptopublicencryptkey-buffer ) | | |
55-
56- ## DiffieHellman
57-
58- | API | Supported? | Notes |
59- | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----- |
60- | [ createDiffieHellman(prime)] ( https://nodejs.org/api/crypto.html#cryptocreatediffiehellmanprime-primeencoding-generator-generatorencoding ) | ✅ | |
61- | [ createDiffieHellman(primeLength)] ( https://nodejs.org/api/crypto.html#cryptocreatediffiehellmanprimelength-generator ) | ✅ | |
62- | [ createDiffieHellmanGroup] ( https://nodejs.org/api/crypto.html#cryptocreatediffiehellmangroupname ) | ✅ | |
63- | [ createECDH] ( https://nodejs.org/api/crypto.html#cryptocreateecdhcurvename ) | | |
64- | [ diffieHellman] ( https://nodejs.org/api/crypto.html#cryptodiffiehellmanoptions ) | | |
65- | [ getDiffieHellman] ( https://nodejs.org/api/crypto.html#cryptogetdiffiehellmangroupname ) | ✅ | |
66-
67- ## Hash
68-
69- | API | Supported? | Notes |
70- | -------------------------------------------------------------------------------------- | ---------- | ----- |
71- | [ createHash] ( https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options ) | ✅ | |
72- | [ createHmac] ( https://nodejs.org/api/crypto.html#cryptocreatehmacalgorithm-key-options ) | ✅ | |
73- | [ getHashes] ( https://nodejs.org/api/crypto.html#cryptogethashes ) | ✅ | |
74-
75- ## Keys
76-
77- | API | Supported? | Notes |
78- | ------------------------------------------------------------------------------------------------ | ---------- | ----- |
79- | [ createPrivateKey] ( https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey ) | ✅ | |
80- | [ createPublicKey] ( https://nodejs.org/api/crypto.html#cryptocreatepublickeykey ) | ✅ | |
81- | [ createSecretKey] ( https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding ) | ✅ | |
82- | [ generateKey] ( https://nodejs.org/api/crypto.html#cryptogeneratekeytype-options-callback ) | ✅ | |
83- | [ generateKeyPair] ( https://nodejs.org/api/crypto.html#cryptogeneratekeypairtype-options-callback ) | ✅ | Does not support DSA or DH key pairs |
84- | [ generateKeyPairSync] ( https://nodejs.org/api/crypto.html#cryptogeneratekeypairsynctype-options ) | ✅ | Does not support DSA or DH key pairs |
85- | [ generateKeySync] ( https://nodejs.org/api/crypto.html#cryptogeneratekeysynctype-options ) | ✅ | |
86-
87- ## Sign/Verify
88-
89- | API | Supported? | Notes |
90- | ---------------------------------------------------------------------------------------------- | ---------- | ----- |
91- | [ createSign] ( https://nodejs.org/api/crypto.html#cryptocreatesignalgorithm-options ) | | |
92- | [ createVerify] ( https://nodejs.org/api/crypto.html#cryptocreateverifyalgorithm-options ) | | |
93- | [ sign] ( https://nodejs.org/api/crypto.html#cryptosignalgorithm-data-key-callback ) | | |
94- | [ verify] ( https://nodejs.org/api/crypto.html#cryptoverifyalgorithm-data-key-signature-callback ) | | |
95-
96- ## Misc
97-
98- | API | Supported? | Notes |
99- | ---------------------------------------------------------------------------------------- | ---------- | ----- |
100- | [ getCipherInfo] ( https://nodejs.org/api/crypto.html#cryptogetcipherinfonameornid-options ) | | |
101- | [ getCiphers] ( https://nodejs.org/api/crypto.html#cryptogetciphers ) | ✅ | |
102- | [ getCurves] ( https://nodejs.org/api/crypto.html#cryptogetcurves ) | ✅ | |
103- | [ secureHeapUsed] ( https://nodejs.org/api/crypto.html#cryptosecureheapused ) | ✅ | |
104- | [ setEngine] ( https://nodejs.org/api/crypto.html#cryptosetengineengine-flags ) | ✅ | |
105- | [ timingSafeEqual] ( https://nodejs.org/api/crypto.html#cryptotimingsafeequala-b ) | ✅ | |
106-
107- ## Fips
108-
109- | API | Supported? | Notes |
110- | --------------------------------------------------------------- | ---------- | ----------------------------------- |
111- | [ getFips] ( https://nodejs.org/api/crypto.html#cryptogetfips ) | ✅ | |
112- | [ fips] ( https://nodejs.org/api/crypto.html#cryptofips ) | ✅ | Deprecated, use ` getFips() ` instead |
113- | [ setFips] ( https://nodejs.org/api/crypto.html#cryptosetfipsbool ) | ✅ | |
114-
115- ## Random
116-
117- | API | Supported? | Notes |
118- | -------------------------------------------------------------------------------------------- | ---------- | ----- |
119- | [ getRandomValues] ( https://nodejs.org/api/crypto.html#cryptogetrandomvaluestypedarray ) | ✅ | |
120- | [ randomBytes] ( https://nodejs.org/api/crypto.html#cryptorandombytessize-callback ) | ✅ | |
121- | [ randomFillSync] ( https://nodejs.org/api/crypto.html#cryptorandomfillsyncbuffer-offset-size ) | ✅ | |
122- | [ randomFill] ( https://nodejs.org/api/crypto.html#cryptorandomfillbuffer-offset-size-callback ) | ✅ | |
123- | [ randomInt] ( https://nodejs.org/api/crypto.html#cryptorandomintmin-max-callback ) | ✅ | |
124- | [ randomUUID] ( https://nodejs.org/api/crypto.html#cryptorandomuuidoptions ) | ✅ | |
125-
126- ## Key Derivation
127-
128- | API | Supported? | Notes |
129- | ------------------------------------------------------------------------------------------------------------ | ---------- | ------------------------------ |
130- | [ hkdf] ( https://nodejs.org/api/crypto.html#cryptohkdfdigest-ikm-salt-info-keylen-callback ) | ✅ | Does not yet support KeyObject |
131- | [ hkdfSync] ( https://nodejs.org/api/crypto.html#cryptohkdfsyncdigest-ikm-salt-info-keylen ) | ✅ | Does not yet support KeyObject |
132- | [ pbkdf2] ( https://nodejs.org/api/crypto.html#cryptopbkdf2password-salt-iterations-keylen-digest-callback ) | ✅ | |
133- | [ pbkdf2Sync] ( https://nodejs.org/api/crypto.html#cryptopbkdf2password-salt-iterations-keylen-digest-callback ) | ✅ | |
134- | [ scrypt] ( https://nodejs.org/api/crypto.html#cryptoscryptpassword-salt-keylen-options-callback ) | ✅ | |
135- | [ scryptSync] ( https://nodejs.org/api/crypto.html#cryptoscryptsyncpassword-salt-keylen-options ) | ✅ | |
136-
137- ## WebCrypto
138-
139- | API | Supported? | Notes |
140- | --------------------------------------------------------- | ---------- | ----- |
141- | [ subtle] ( https://nodejs.org/api/crypto.html#cryptosubtle ) | ✅ | |
142- | [ webcrypto] ( https://nodejs.org/api/crypto.html# ) | ✅ | |
20+ The [ WebCrypto API] ( /workers/runtime-apis/web-crypto/ ) is also available within Cloudflare Workers. This does not
21+ require the ` nodejs_compat ` compatibility flag.
0 commit comments