4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
12 description("Tests deriveBits() with various bad parameters for PBKDF2");
23 function importPbkdf2Key() {
26 debug("Importing the password...");
28 var algorithm
= {name
: 'PBKDF2'};
30 var password
= asciiToUint8Array(testCase
.password
);
31 var usages
= ['deriveBits', 'deriveKey'];
32 var extractable
= false;
34 // (1) Import the password
35 return crypto
.subtle
.importKey('raw', password
, algorithm
, extractable
, usages
).then(function(result
) {
45 salt
: asciiToUint8Array(testCase
.salt
),
46 iterations
: testCase
.c
,
47 hash
: {name
: testCase
.hash
}
49 importPbkdf2Key().then(function(result
) {
51 debug("\nDeriving 100 bits...");
52 return crypto
.subtle
.deriveBits(params
, pbkdf2Key
, 100);
53 }).then(failAndFinishJSTest
, function(result
) {
57 }).then(finishJSTest
, failAndFinishJSTest
);