( baseKeys, size, saltSize, hash, iterations)
| 458 | } |
| 459 | |
| 460 | async function testDeriveBitsBadHash( |
| 461 | baseKeys, |
| 462 | size, |
| 463 | saltSize, |
| 464 | hash, |
| 465 | iterations) { |
| 466 | const salt = Buffer.from(kSalts[saltSize], 'hex'); |
| 467 | const algorithm = { name: 'PBKDF2', salt, iterations }; |
| 468 | |
| 469 | return Promise.all([ |
| 470 | assert.rejects( |
| 471 | subtle.deriveBits( |
| 472 | { |
| 473 | ...algorithm, |
| 474 | hash: hash.substring(0, 3) + hash.substring(4), |
| 475 | }, baseKeys[size], 256), { |
| 476 | name: 'NotSupportedError', |
| 477 | }), |
| 478 | assert.rejects( |
| 479 | subtle.deriveBits( |
| 480 | { |
| 481 | ...algorithm, |
| 482 | hash: 'HKDF', |
| 483 | }, |
| 484 | baseKeys[size], 256), { |
| 485 | name: 'NotSupportedError', |
| 486 | }), |
| 487 | ]); |
| 488 | } |
| 489 | |
| 490 | async function testDeriveBitsBadUsage( |
| 491 | noBits, |
no test coverage detected