crypto: require HMAC key length with SHA-3 hashes in Web Cryptography · nodejs/node@72937e5
@@ -19,24 +19,26 @@ export const vectors = {
1919[!boringSSL, 'SHA3-512'],
2020],
2121'generateKey': [
22-[!boringSSL, { name: 'HMAC', hash: 'SHA3-256' }],
2322[!boringSSL, { name: 'HMAC', hash: 'SHA3-256', length: 256 }],
2423[false, { name: 'HMAC', hash: 'SHA3-256', length: 25 }],
2524[!boringSSL, { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA3-256', ...RSA_KEY_GEN }],
2625[!boringSSL, { name: 'RSA-PSS', hash: 'SHA3-256', ...RSA_KEY_GEN }],
2726[!boringSSL, { name: 'RSA-OAEP', hash: 'SHA3-256', ...RSA_KEY_GEN }],
28-[!boringSSL, { name: 'HMAC', hash: 'SHA3-256' }],
2927[!boringSSL, { name: 'HMAC', hash: 'SHA3-256', length: 256 }],
3028[false, { name: 'HMAC', hash: 'SHA3-256', length: 25 }],
3129[false, { name: 'HMAC', hash: 'SHA3-256', length: 0 }],
30+31+// This interaction is not defined for now.
32+// https://github.com/WICG/webcrypto-modern-algos/issues/23
33+[false, { name: 'HMAC', hash: 'SHA3-256' }],
3234],
3335'deriveKey': [
3436[!boringSSL,
3537{ name: 'HKDF', hash: 'SHA3-256', salt: Buffer.alloc(0), info: Buffer.alloc(0) },
3638{ name: 'AES-CBC', length: 128 }],
3739[!boringSSL,
3840{ name: 'HKDF', hash: 'SHA3-256', salt: Buffer.alloc(0), info: Buffer.alloc(0) },
39-{ name: 'HMAC', hash: 'SHA3-256' }],
41+{ name: 'HMAC', hash: 'SHA3-256', length: 256 }],
4042[false,
4143{ name: 'HKDF', hash: 'SHA3-256', salt: Buffer.alloc(0), info: Buffer.alloc(0) },
4244'HKDF'],
@@ -45,14 +47,29 @@ export const vectors = {
4547{ name: 'AES-CBC', length: 128 }],
4648[!boringSSL,
4749{ name: 'PBKDF2', hash: 'SHA3-256', salt: Buffer.alloc(0), iterations: 1 },
48-{ name: 'HMAC', hash: 'SHA3-256' }],
50+{ name: 'HMAC', hash: 'SHA3-256', length: 256 }],
4951[false,
5052{ name: 'PBKDF2', hash: 'SHA3-256', salt: Buffer.alloc(0), iterations: 1 },
5153'HKDF'],
5254[!boringSSL,
5355{ name: 'X25519', public: X25519.publicKey },
54-{ name: 'HMAC', hash: 'SHA3-256' }],
56+{ name: 'HMAC', hash: 'SHA3-256', length: 256 }],
5557[!boringSSL,
58+{ name: 'ECDH', public: ECDH.publicKey },
59+{ name: 'HMAC', hash: 'SHA3-256', length: 256 }],
60+61+// This interaction is not defined for now.
62+// https://github.com/WICG/webcrypto-modern-algos/issues/23
63+[false,
64+{ name: 'HKDF', hash: 'SHA3-256', salt: Buffer.alloc(0), info: Buffer.alloc(0) },
65+{ name: 'HMAC', hash: 'SHA3-256' }],
66+[false,
67+{ name: 'PBKDF2', hash: 'SHA3-256', salt: Buffer.alloc(0), iterations: 1 },
68+{ name: 'HMAC', hash: 'SHA3-256' }],
69+[false,
70+{ name: 'X25519', public: X25519.publicKey },
71+{ name: 'HMAC', hash: 'SHA3-256' }],
72+[false,
5673{ name: 'ECDH', public: ECDH.publicKey },
5774{ name: 'HMAC', hash: 'SHA3-256' }],
5875],