summaryrefslogtreecommitdiff
path: root/tests/unit_node/crypto/crypto_cipher_gcm_test.ts
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-08-28 18:34:18 +0530
committerGitHub <noreply@github.com>2024-08-28 18:34:18 +0530
commit3394c4df751229b6ce2349e84dccdee26faecb67 (patch)
treeff18b6c9489e7e04ea7e3689e316698d5932f858 /tests/unit_node/crypto/crypto_cipher_gcm_test.ts
parent44238955fb3c70074e7bc8191efdf3e0143bed16 (diff)
fix(ext/node): update aead-gcm-stream to 0.3 (#25261)
Fixes https://github.com/denoland/deno/issues/25260 Fixes https://github.com/denoland/deno/issues/25254 Fixes https://github.com/denoland/deno/issues/23693 Verified that `web-push` GCM decryption works in the browser. See `aead-gcm-stream` changes [here](https://github.com/littledivy/aead-gcm-stream/commit/a9ffd0c07c14e4b566c87bf51a20ff799b9e7f5e)
Diffstat (limited to 'tests/unit_node/crypto/crypto_cipher_gcm_test.ts')
-rw-r--r--tests/unit_node/crypto/crypto_cipher_gcm_test.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit_node/crypto/crypto_cipher_gcm_test.ts b/tests/unit_node/crypto/crypto_cipher_gcm_test.ts
index e87ae23f0..b379a4369 100644
--- a/tests/unit_node/crypto/crypto_cipher_gcm_test.ts
+++ b/tests/unit_node/crypto/crypto_cipher_gcm_test.ts
@@ -101,3 +101,21 @@ for (
});
}
}
+
+Deno.test({
+ name: "aes-128-gcm encrypt multiple",
+ fn() {
+ const key = Buffer.alloc(16);
+ const nonce = Buffer.alloc(12);
+
+ const gcm = crypto.createCipheriv("aes-128-gcm", key, nonce);
+
+ assertEquals(gcm.update("hello", "utf8", "hex"), "6bedb6a20f");
+ assertEquals(gcm.update("world", "utf8", "hex"), "c1cce09f4c");
+ gcm.final();
+ assertEquals(
+ gcm.getAuthTag().toString("hex"),
+ "bf6d20a38e0c828bea3de63b7ff1dfbd",
+ );
+ },
+});