summaryrefslogtreecommitdiff
path: root/tests/unit_node/crypto/crypto_cipher_gcm_test.ts
diff options
context:
space:
mode:
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",
+ );
+ },
+});