MCPcopy Create free account
hub / github.com/nodejs/node / testDeriveKeyBadHash

Function testDeriveKeyBadHash

test/pummel/test-webcrypto-derivebits-pbkdf2.js:540–575  ·  view source on GitHub ↗
(
  baseKeys,
  size,
  saltSize,
  hash,
  iterations,
  keyType,
  usages)

Source from the content-addressed store, hash-verified

538}
539
540async function testDeriveKeyBadHash(
541 baseKeys,
542 size,
543 saltSize,
544 hash,
545 iterations,
546 keyType,
547 usages) {
548 const salt = Buffer.from(kSalts[saltSize], 'hex');
549 const algorithm = { name: 'PBKDF2', salt, iterations };
550
551 return Promise.all([
552 assert.rejects(
553 subtle.deriveKey(
554 {
555 ...algorithm,
556 hash: hash.substring(0, 3) + hash.substring(4),
557 },
558 baseKeys[size],
559 keyType,
560 true,
561 usages),
562 { name: 'NotSupportedError' }),
563 assert.rejects(
564 subtle.deriveKey(
565 {
566 ...algorithm,
567 hash: 'HKDF',
568 },
569 baseKeys[size],
570 keyType,
571 true,
572 usages),
573 { name: 'NotSupportedError' }),
574 ]);
575}
576
577async function testDeriveKeyBadUsage(
578 noKey,

Calls 2

allMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected