summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/unit/webcrypto_test.ts8
-rw-r--r--ext/crypto/00_crypto.js5
2 files changed, 7 insertions, 6 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts
index 0e7e2829a..c942e36c6 100644
--- a/cli/tests/unit/webcrypto_test.ts
+++ b/cli/tests/unit/webcrypto_test.ts
@@ -1443,7 +1443,7 @@ Deno.test(async function testAesGcmEncrypt() {
const data = new Uint8Array([1, 2, 3]);
const cipherText = await crypto.subtle.encrypt(
- { name: "AES-GCM", iv, additionalData: new Uint8Array() },
+ { name: "AES-GCM", iv },
key,
data,
);
@@ -1457,7 +1457,7 @@ Deno.test(async function testAesGcmEncrypt() {
);
const plainText = await crypto.subtle.decrypt(
- { name: "AES-GCM", iv, additionalData: new Uint8Array() },
+ { name: "AES-GCM", iv },
key,
cipherText,
);
@@ -1655,14 +1655,14 @@ Deno.test(async function testAesGcmTagLength() {
// encrypt won't fail, it will simply truncate the tag
// as expected.
const encrypted = await crypto.subtle.encrypt(
- { name: "AES-GCM", iv, tagLength: 96, additionalData: new Uint8Array() },
+ { name: "AES-GCM", iv, tagLength: 96 },
key,
new Uint8Array(32),
);
await assertRejects(async () => {
await crypto.subtle.decrypt(
- { name: "AES-GCM", iv, tagLength: 96, additionalData: new Uint8Array() },
+ { name: "AES-GCM", iv, tagLength: 96 },
key,
encrypted,
);
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 0bde30c5f..8203a5307 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -691,7 +691,8 @@
algorithm: "AES-GCM",
length: key[_algorithm].length,
iv: normalizedAlgorithm.iv,
- additionalData: normalizedAlgorithm.additionalData,
+ additionalData: normalizedAlgorithm.additionalData ||
+ null,
tagLength: normalizedAlgorithm.tagLength,
}, data);
@@ -3825,7 +3826,7 @@
algorithm: "AES-GCM",
length: key[_algorithm].length,
iv: normalizedAlgorithm.iv,
- additionalData: normalizedAlgorithm.additionalData,
+ additionalData: normalizedAlgorithm.additionalData || null,
tagLength: normalizedAlgorithm.tagLength,
}, data);