| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2004d8d commit 38befee
39 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,9 +54,6 @@ const bench = common.createBenchmark(main, { | |||
| 54 | 54 | // assess whether mutexes over the key material impact the operation | |
| 55 | 55 | if (p.keyFormat === 'keyObject.unique') | |
| 56 | 56 | return p.mode === 'async-parallel'; | |
| 57 | - // JWK is not supported for ml-kem for now | ||
| 58 | - if (p.keyFormat === 'jwk') | ||
| 59 | - return !p.keyType.startsWith('ml-'); | ||
| 60 | 57 | // raw-public is only supported for encapsulate, not rsa | |
| 61 | 58 | if (p.keyFormat === 'raw-public') | |
| 62 | 59 | return p.keyType !== 'rsa' && p.op === 'encapsulate'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -88,23 +88,23 @@ The following table lists the asymmetric key types recognized by the | |||
| 88 | 88 | | `'ml-dsa-44'`[^openssl35] | ML-DSA-44 | 2.16.840.1.101.3.4.3.17 | ✔ | ✔ | ✔ | ✔ | | ✔ | | |
| 89 | 89 | | `'ml-dsa-65'`[^openssl35] | ML-DSA-65 | 2.16.840.1.101.3.4.3.18 | ✔ | ✔ | ✔ | ✔ | | ✔ | | |
| 90 | 90 | | `'ml-dsa-87'`[^openssl35] | ML-DSA-87 | 2.16.840.1.101.3.4.3.19 | ✔ | ✔ | ✔ | ✔ | | ✔ | | |
| 91 | - | `'ml-kem-512'`[^openssl35] | ML-KEM-512 | 2.16.840.1.101.3.4.4.1 | ✔ | ✔ | | ✔ | | ✔ | | ||
| 92 | - | `'ml-kem-768'`[^openssl35] | ML-KEM-768 | 2.16.840.1.101.3.4.4.2 | ✔ | ✔ | | ✔ | | ✔ | | ||
| 93 | - | `'ml-kem-1024'`[^openssl35] | ML-KEM-1024 | 2.16.840.1.101.3.4.4.3 | ✔ | ✔ | | ✔ | | ✔ | | ||
| 91 | + | `'ml-kem-512'`[^openssl35] | ML-KEM-512 | 2.16.840.1.101.3.4.4.1 | ✔ | ✔ | ✔ | ✔ | | ✔ | | ||
| 92 | + | `'ml-kem-768'`[^openssl35] | ML-KEM-768 | 2.16.840.1.101.3.4.4.2 | ✔ | ✔ | ✔ | ✔ | | ✔ | | ||
| 93 | + | `'ml-kem-1024'`[^openssl35] | ML-KEM-1024 | 2.16.840.1.101.3.4.4.3 | ✔ | ✔ | ✔ | ✔ | | ✔ | | ||
| 94 | 94 | | `'rsa-pss'` | RSA PSS | 1.2.840.113549.1.1.10 | ✔ | ✔ | | | | | | |
| 95 | 95 | | `'rsa'` | RSA | 1.2.840.113549.1.1.1 | ✔ | ✔ | ✔ | | | | | |
| 96 | - | `'slh-dsa-sha2-128f'`[^openssl35] | SLH-DSA-SHA2-128f | 2.16.840.1.101.3.4.3.21 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 97 | - | `'slh-dsa-sha2-128s'`[^openssl35] | SLH-DSA-SHA2-128s | 2.16.840.1.101.3.4.3.20 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 98 | - | `'slh-dsa-sha2-192f'`[^openssl35] | SLH-DSA-SHA2-192f | 2.16.840.1.101.3.4.3.23 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 99 | - | `'slh-dsa-sha2-192s'`[^openssl35] | SLH-DSA-SHA2-192s | 2.16.840.1.101.3.4.3.22 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 100 | - | `'slh-dsa-sha2-256f'`[^openssl35] | SLH-DSA-SHA2-256f | 2.16.840.1.101.3.4.3.25 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 101 | - | `'slh-dsa-sha2-256s'`[^openssl35] | SLH-DSA-SHA2-256s | 2.16.840.1.101.3.4.3.24 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 102 | - | `'slh-dsa-shake-128f'`[^openssl35] | SLH-DSA-SHAKE-128f | 2.16.840.1.101.3.4.3.27 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 103 | - | `'slh-dsa-shake-128s'`[^openssl35] | SLH-DSA-SHAKE-128s | 2.16.840.1.101.3.4.3.26 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 104 | - | `'slh-dsa-shake-192f'`[^openssl35] | SLH-DSA-SHAKE-192f | 2.16.840.1.101.3.4.3.29 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 105 | - | `'slh-dsa-shake-192s'`[^openssl35] | SLH-DSA-SHAKE-192s | 2.16.840.1.101.3.4.3.28 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 106 | - | `'slh-dsa-shake-256f'`[^openssl35] | SLH-DSA-SHAKE-256f | 2.16.840.1.101.3.4.3.31 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 107 | - | `'slh-dsa-shake-256s'`[^openssl35] | SLH-DSA-SHAKE-256s | 2.16.840.1.101.3.4.3.30 | ✔ | ✔ | | ✔ | ✔ | | | ||
| 96 | + | `'slh-dsa-sha2-128f'`[^openssl35] | SLH-DSA-SHA2-128f | 2.16.840.1.101.3.4.3.21 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 97 | + | `'slh-dsa-sha2-128s'`[^openssl35] | SLH-DSA-SHA2-128s | 2.16.840.1.101.3.4.3.20 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 98 | + | `'slh-dsa-sha2-192f'`[^openssl35] | SLH-DSA-SHA2-192f | 2.16.840.1.101.3.4.3.23 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 99 | + | `'slh-dsa-sha2-192s'`[^openssl35] | SLH-DSA-SHA2-192s | 2.16.840.1.101.3.4.3.22 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 100 | + | `'slh-dsa-sha2-256f'`[^openssl35] | SLH-DSA-SHA2-256f | 2.16.840.1.101.3.4.3.25 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 101 | + | `'slh-dsa-sha2-256s'`[^openssl35] | SLH-DSA-SHA2-256s | 2.16.840.1.101.3.4.3.24 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 102 | + | `'slh-dsa-shake-128f'`[^openssl35] | SLH-DSA-SHAKE-128f | 2.16.840.1.101.3.4.3.27 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 103 | + | `'slh-dsa-shake-128s'`[^openssl35] | SLH-DSA-SHAKE-128s | 2.16.840.1.101.3.4.3.26 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 104 | + | `'slh-dsa-shake-192f'`[^openssl35] | SLH-DSA-SHAKE-192f | 2.16.840.1.101.3.4.3.29 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 105 | + | `'slh-dsa-shake-192s'`[^openssl35] | SLH-DSA-SHAKE-192s | 2.16.840.1.101.3.4.3.28 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 106 | + | `'slh-dsa-shake-256f'`[^openssl35] | SLH-DSA-SHAKE-256f | 2.16.840.1.101.3.4.3.31 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 107 | + | `'slh-dsa-shake-256s'`[^openssl35] | SLH-DSA-SHAKE-256s | 2.16.840.1.101.3.4.3.30 | ✔ | ✔ | ✔ | ✔ | ✔ | | | ||
| 108 | 108 | | `'x25519'` | X25519 | 1.3.101.110 | ✔ | ✔ | ✔ | ✔ | ✔ | | | |
| 109 | 109 | | `'x448'` | X448 | 1.3.101.111 | ✔ | ✔ | ✔ | ✔ | ✔ | | | |
| 110 | 110 | ||
@@ -2399,6 +2399,10 @@ type, value, and parameters. This method is not | |||
| 2399 | 2399 | <!-- YAML | |
| 2400 | 2400 | added: v11.6.0 | |
| 2401 | 2401 | changes: | |
| 2402 | + - version: REPLACEME | ||
| 2403 | + pr-url: https://github.com/nodejs/node/pull/62706 | ||
| 2404 | + description: Added JWK format support for ML-KEM and SLH-DSA | ||
| 2405 | + key types. | ||
| 2402 | 2406 | - version: v26.0.0 | |
| 2403 | 2407 | pr-url: https://github.com/nodejs/node/pull/62240 | |
| 2404 | 2408 | description: Added support for `'raw-public'`, `'raw-private'`, | |
@@ -3928,6 +3932,10 @@ input.on('readable', () => { | |||
| 3928 | 3932 | <!-- YAML | |
| 3929 | 3933 | added: v11.6.0 | |
| 3930 | 3934 | changes: | |
| 3935 | + - version: REPLACEME | ||
| 3936 | + pr-url: https://github.com/nodejs/node/pull/62706 | ||
| 3937 | + description: Added JWK format support for ML-KEM and SLH-DSA | ||
| 3938 | + key types. | ||
| 3931 | 3939 | - version: v26.0.0 | |
| 3932 | 3940 | pr-url: https://github.com/nodejs/node/pull/62453 | |
| 3933 | 3941 | description: Passing a CryptoKey as `key` is deprecated. | |
@@ -3979,6 +3987,10 @@ of the passphrase is limited to 1024 bytes. | |||
| 3979 | 3987 | <!-- YAML | |
| 3980 | 3988 | added: v11.6.0 | |
| 3981 | 3989 | changes: | |
| 3990 | + - version: REPLACEME | ||
| 3991 | + pr-url: https://github.com/nodejs/node/pull/62706 | ||
| 3992 | + description: Added JWK format support for ML-KEM and SLH-DSA | ||
| 3993 | + key types. | ||
| 3982 | 3994 | - version: v26.0.0 | |
| 3983 | 3995 | pr-url: https://github.com/nodejs/node/pull/62453 | |
| 3984 | 3996 | description: Passing a CryptoKey as `key` is deprecated. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1132,6 +1132,9 @@ The algorithms currently supported include: | |||
| 1132 | 1132 | <!-- YAML | |
| 1133 | 1133 | added: v15.0.0 | |
| 1134 | 1134 | changes: | |
| 1135 | + - version: REPLACEME | ||
| 1136 | + pr-url: https://github.com/nodejs/node/pull/62706 | ||
| 1137 | + description: Added JWK format support for ML-KEM key types. | ||
| 1135 | 1138 | - version: v24.8.0 | |
| 1136 | 1139 | pr-url: https://github.com/nodejs/node/pull/59647 | |
| 1137 | 1140 | description: KMAC algorithms are now supported. | |
@@ -1190,9 +1193,9 @@ specification. | |||
| 1190 | 1193 | | `'ML-DSA-44'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | |
| 1191 | 1194 | | `'ML-DSA-65'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | |
| 1192 | 1195 | | `'ML-DSA-87'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | |
| 1193 | - | `'ML-KEM-512'`[^modern-algos] | ✔ | ✔ | | | | ✔ | ✔ | | ||
| 1194 | - | `'ML-KEM-768'`[^modern-algos] | ✔ | ✔ | | | | ✔ | ✔ | | ||
| 1195 | - | `'ML-KEM-1024'`[^modern-algos] | ✔ | ✔ | | | | ✔ | ✔ | | ||
| 1196 | + | `'ML-KEM-512'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | ||
| 1197 | + | `'ML-KEM-768'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | ||
| 1198 | + | `'ML-KEM-1024'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | ||
| 1196 | 1199 | | `'RSA-OAEP'` | ✔ | ✔ | ✔ | | | | | | |
| 1197 | 1200 | | `'RSA-PSS'` | ✔ | ✔ | ✔ | | | | | | |
| 1198 | 1201 | | `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | | | | | |
@@ -1280,6 +1283,9 @@ The {CryptoKey} (secret key) generating algorithms supported include: | |||
| 1280 | 1283 | <!-- YAML | |
| 1281 | 1284 | added: v15.0.0 | |
| 1282 | 1285 | changes: | |
| 1286 | + - version: REPLACEME | ||
| 1287 | + pr-url: https://github.com/nodejs/node/pull/62706 | ||
| 1288 | + description: Added JWK format support for ML-KEM key types. | ||
| 1283 | 1289 | - version: v26.0.0 | |
| 1284 | 1290 | pr-url: https://github.com/nodejs/node/pull/62218 | |
| 1285 | 1291 | description: Importing ML-DSA and ML-KEM PKCS#8 keys | |
@@ -1353,9 +1359,9 @@ The algorithms currently supported include: | |||
| 1353 | 1359 | | `'ML-DSA-44'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | |
| 1354 | 1360 | | `'ML-DSA-65'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | |
| 1355 | 1361 | | `'ML-DSA-87'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | |
| 1356 | - | `'ML-KEM-512'`[^modern-algos] | ✔ | ✔ | | | | ✔ | ✔ | | ||
| 1357 | - | `'ML-KEM-768'`[^modern-algos] | ✔ | ✔ | | | | ✔ | ✔ | | ||
| 1358 | - | `'ML-KEM-1024'`[^modern-algos] | ✔ | ✔ | | | | ✔ | ✔ | | ||
| 1362 | + | `'ML-KEM-512'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | ||
| 1363 | + | `'ML-KEM-768'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | ||
| 1364 | + | `'ML-KEM-1024'`[^modern-algos] | ✔ | ✔ | ✔ | | | ✔ | ✔ | | ||
| 1359 | 1365 | | `'PBKDF2'` | | | | ✔ | ✔ | | | | |
| 1360 | 1366 | | `'RSA-OAEP'` | ✔ | ✔ | ✔ | | | | | | |
| 1361 | 1367 | | `'RSA-PSS'` | ✔ | ✔ | ✔ | | | | | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,7 +43,9 @@ const { | |||
| 43 | 43 | ||
| 44 | 44 | const { | |
| 45 | 45 | importDerKey, | |
| 46 | + importJwkKey, | ||
| 46 | 47 | importRawKey, | |
| 48 | + validateJwk, | ||
| 47 | 49 | } = require('internal/crypto/webcrypto_util'); | |
| 48 | 50 | ||
| 49 | 51 | const generateKeyPair = promisify(_generateKeyPair); | |
@@ -177,6 +179,18 @@ function mlKemImportKey( | |||
| 177 | 179 | keyObject = importRawKey(isPublic, keyData, isPublic ? kKeyFormatRawPublic : kKeyFormatRawPrivate, name); | |
| 178 | 180 | break; | |
| 179 | 181 | } | |
| 182 | + case 'jwk': { | ||
| 183 | + validateJwk(keyData, 'AKP', extractable, usagesSet, 'enc'); | ||
| 184 | + | ||
| 185 | + if (keyData.alg !== name) | ||
| 186 | + throw lazyDOMException( | ||
| 187 | + 'JWK "alg" Parameter and algorithm name mismatch', 'DataError'); | ||
| 188 | + | ||
| 189 | + const isPublic = keyData.priv === undefined; | ||
| 190 | + verifyAcceptableMlKemKeyUse(name, isPublic, usagesSet); | ||
| 191 | + keyObject = importJwkKey(isPublic, keyData); | ||
| 192 | + break; | ||
| 193 | + } | ||
| 180 | 194 | default: | |
| 181 | 195 | return undefined; | |
| 182 | 196 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -603,6 +603,12 @@ async function exportKeyJWK(key) { | |||
| 603 | 603 | case 'ML-DSA-65': | |
| 604 | 604 | // Fall through | |
| 605 | 605 | case 'ML-DSA-87': | |
| 606 | + // Fall through | ||
| 607 | + case 'ML-KEM-512': | ||
| 608 | + // Fall through | ||
| 609 | + case 'ML-KEM-768': | ||
| 610 | + // Fall through | ||
| 611 | + case 'ML-KEM-1024': | ||
| 606 | 612 | break; | |
| 607 | 613 | case 'Ed25519': | |
| 608 | 614 | // Fall through | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -394,7 +394,7 @@ | |||
| 394 | 394 | 'src/crypto/crypto_cipher.cc', | |
| 395 | 395 | 'src/crypto/crypto_context.cc', | |
| 396 | 396 | 'src/crypto/crypto_ec.cc', | |
| 397 | - 'src/crypto/crypto_ml_dsa.cc', | ||
| 397 | + 'src/crypto/crypto_pqc.cc', | ||
| 398 | 398 | 'src/crypto/crypto_kem.cc', | |
| 399 | 399 | 'src/crypto/crypto_hmac.cc', | |
| 400 | 400 | 'src/crypto/crypto_kmac.cc', | |
@@ -432,7 +432,7 @@ | |||
| 432 | 432 | 'src/crypto/crypto_clienthello.h', | |
| 433 | 433 | 'src/crypto/crypto_context.h', | |
| 434 | 434 | 'src/crypto/crypto_ec.h', | |
| 435 | - 'src/crypto/crypto_ml_dsa.h', | ||
| 435 | + 'src/crypto/crypto_pqc.h', | ||
| 436 | 436 | 'src/crypto/crypto_hkdf.h', | |
| 437 | 437 | 'src/crypto/crypto_pbkdf2.h', | |
| 438 | 438 | 'src/crypto/crypto_sig.h', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | #include "crypto/crypto_dh.h" | |
| 6 | 6 | #include "crypto/crypto_dsa.h" | |
| 7 | 7 | #include "crypto/crypto_ec.h" | |
| 8 | - #include "crypto/crypto_ml_dsa.h" | ||
| 8 | + #include "crypto/crypto_pqc.h" | ||
| 9 | 9 | #include "crypto/crypto_rsa.h" | |
| 10 | 10 | #include "crypto/crypto_util.h" | |
| 11 | 11 | #include "env-inl.h" | |
@@ -200,7 +200,37 @@ bool ExportJWKAsymmetricKey(Environment* env, | |||
| 200 | 200 | case EVP_PKEY_ML_DSA_65: | |
| 201 | 201 | // Fall through | |
| 202 | 202 | case EVP_PKEY_ML_DSA_87: | |
| 203 | - return ExportJwkMlDsaKey(env, key, target); | ||
| 203 | + // Fall through | ||
| 204 | + case EVP_PKEY_SLH_DSA_SHA2_128F: | ||
| 205 | + // Fall through | ||
| 206 | + case EVP_PKEY_SLH_DSA_SHA2_128S: | ||
| 207 | + // Fall through | ||
| 208 | + case EVP_PKEY_SLH_DSA_SHA2_192F: | ||
| 209 | + // Fall through | ||
| 210 | + case EVP_PKEY_SLH_DSA_SHA2_192S: | ||
| 211 | + // Fall through | ||
| 212 | + case EVP_PKEY_SLH_DSA_SHA2_256F: | ||
| 213 | + // Fall through | ||
| 214 | + case EVP_PKEY_SLH_DSA_SHA2_256S: | ||
| 215 | + // Fall through | ||
| 216 | + case EVP_PKEY_SLH_DSA_SHAKE_128F: | ||
| 217 | + // Fall through | ||
| 218 | + case EVP_PKEY_SLH_DSA_SHAKE_128S: | ||
| 219 | + // Fall through | ||
| 220 | + case EVP_PKEY_SLH_DSA_SHAKE_192F: | ||
| 221 | + // Fall through | ||
| 222 | + case EVP_PKEY_SLH_DSA_SHAKE_192S: | ||
| 223 | + // Fall through | ||
| 224 | + case EVP_PKEY_SLH_DSA_SHAKE_256F: | ||
| 225 | + // Fall through | ||
| 226 | + case EVP_PKEY_SLH_DSA_SHAKE_256S: | ||
| 227 | + // Fall through | ||
| 228 | + case EVP_PKEY_ML_KEM_512: | ||
| 229 | + // Fall through | ||
| 230 | + case EVP_PKEY_ML_KEM_768: | ||
| 231 | + // Fall through | ||
| 232 | + case EVP_PKEY_ML_KEM_1024: | ||
| 233 | + return ExportJwkPqcKey(env, key, target); | ||
| 204 | 234 | #endif | |
| 205 | 235 | } | |
| 206 | 236 | THROW_ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE(env); | |
@@ -723,7 +753,7 @@ static KeyObjectData ImportJWKFromArgs(Environment* env, Local<Object> jwk) { | |||
| 723 | 753 | return ImportJWKEdKey(env, jwk); | |
| 724 | 754 | } else if (*kty_string == std::string_view("AKP")) { | |
| 725 | 755 | #if OPENSSL_WITH_PQC | |
| 726 | - return ImportJWKAkpKey(env, jwk); | ||
| 756 | + return ImportJWKPqcKey(env, jwk); | ||
| 727 | 757 | #else | |
| 728 | 758 | THROW_ERR_INVALID_ARG_VALUE(env, "Unsupported key type"); | |
| 729 | 759 | return {}; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments