Skip to content

Commit 3127c3a

Browse files
minsubb13chromium-wpt-export-bot
authored andcommitted
[WebCrypto] Fix supports() for exportKey and wrapKey
supports() is specified to accept "exportKey" as an operation, and to return false for "wrapKey" when additionalAlgorithm does not support the export key operation. Blink returned false for every "exportKey" query, and returned true for "wrapKey" with an HKDF or PBKDF2 additionalAlgorithm even though wrapKey() rejects such keys with a NotSupportedError: https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-supports Map "exportKey" to kWebCryptoOperationExportKey and add the wrapKey check, using the export key operation info added in https://crrev.com/c/8312049. Add WPTs for both cases. Fixed: 41264071 Change-Id: If0e60ecfc2c52ac7b2fcbbfdfbc2855c00524853 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8471207 Reviewed-by: David Benjamin <[email protected]> Commit-Queue: Minseop Choi <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/main@{#1706614}
1 parent 3b5f16e commit 3127c3a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎WebCryptoAPI/supports.tentative.https.any.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,25 @@ promise_test(async (t) => {
728728
'deriveKey X25519-HMAC-SHA-256 should fail');
729729
}, 'deriveKey promise tests');
730730

731+
// Test supports for exportKey op
732+
test(() => {
733+
assert_true(SubtleCrypto.supports('exportKey', 'AES-GCM'),
734+
'exportKey AES-GCM should pass');
735+
assert_false(SubtleCrypto.supports('exportKey', 'HKDF'),
736+
'exportKey HKDF should fail');
737+
assert_false(SubtleCrypto.supports('exportKey', 'PBKDF2'),
738+
'exportKey PBKDF2 should fail');
739+
}, 'exportKey tests');
740+
741+
// Test supports for wrapKey op
742+
test(() => {
743+
assert_true(SubtleCrypto.supports('wrapKey', 'AES-KW', 'AES-GCM'),
744+
'wrapKey AES-KW-AES-GCM should pass');
745+
assert_false(SubtleCrypto.supports('wrapKey', 'AES-KW', 'HKDF'),
746+
'wrapKey AES-KW-HKDF should fail');
747+
assert_false(SubtleCrypto.supports('wrapKey', 'AES-KW', 'PBKDF2'),
748+
'wrapKey AES-KW-PBKDF2 should fail');
749+
}, 'wrapKey tests');
731750

732751

733752
done();

0 commit comments

Comments
 (0)