Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! crypto: validate this in all webcrypto methods and getters
  • Loading branch information
panva committed Apr 22, 2022
commit 6296ceaa32f416d01095dff932fe97bd1365cc43
29 changes: 15 additions & 14 deletions test/parallel/test-webcrypto-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,22 @@ const notSubtle = Reflect.construct(function() {}, [], SubtleCrypto);
}

{
crypto.subtle.importKey(
globalThis.crypto.subtle.importKey(
'raw',
crypto.getRandomValues(new Uint8Array(4)),
globalThis.crypto.getRandomValues(new Uint8Array(4)),
'PBKDF2',
false,
['deriveKey']).then(key => {
crypto.subtle.importKey = common.mustNotCall();
return crypto.subtle.deriveKey({
name: 'PBKDF2',
hash: 'SHA-512',
salt: crypto.getRandomValues(new Uint8Array()),
iterations: 5
}, key, {
name: 'AES-GCM',
length: 256
}, true, ['encrypt', 'decrypt']);
}).then(common.mustCall());
['deriveKey'],
).then((key) => {
globalThis.crypto.subtle.importKey = common.mustNotCall();
return globalThis.crypto.subtle.deriveKey({
name: 'PBKDF2',
hash: 'SHA-512',
salt: globalThis.crypto.getRandomValues(new Uint8Array()),
iterations: 5,
}, key, {
name: 'AES-GCM',
length: 256
}, true, ['encrypt', 'decrypt']);
}).then(common.mustCall());
}