( baseKeys, size, saltSize, hash, iterations)
| 422 | } |
| 423 | |
| 424 | async function testDeriveBitsBadLengths( |
| 425 | baseKeys, |
| 426 | size, |
| 427 | saltSize, |
| 428 | hash, |
| 429 | iterations) { |
| 430 | const algorithm = { |
| 431 | name: 'PBKDF2', |
| 432 | salt: Buffer.from(kSalts[saltSize], 'hex'), |
| 433 | iterations, |
| 434 | hash, |
| 435 | }; |
| 436 | |
| 437 | return Promise.all([ |
| 438 | assert.rejects( |
| 439 | subtle.deriveBits(algorithm, baseKeys[size], undefined), { |
| 440 | name: 'OperationError', |
| 441 | }), |
| 442 | assert.rejects( |
| 443 | subtle.deriveBits(algorithm, baseKeys[size], null), { |
| 444 | message: 'length cannot be null', |
| 445 | name: 'OperationError', |
| 446 | }), |
| 447 | assert.rejects( |
| 448 | subtle.deriveBits(algorithm, baseKeys[size]), { |
| 449 | message: 'length cannot be null', |
| 450 | name: 'OperationError', |
| 451 | }), |
| 452 | assert.rejects( |
| 453 | subtle.deriveBits(algorithm, baseKeys[size], 15), { |
| 454 | message: /length must be a multiple of 8/, |
| 455 | name: 'OperationError', |
| 456 | }), |
| 457 | ]); |
| 458 | } |
| 459 | |
| 460 | async function testDeriveBitsBadHash( |
| 461 | baseKeys, |
no test coverage detected