From cf3c6f9b0812ad487320834399bc4863dadd9655 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 14 Mar 2024 06:30:29 -0700 Subject: fix(ext/node): crypto.getCipherInfo() (#22916) Stub implementation of getCipherInfo(). Good enough for most cases. Note: We do not support all OpenSSL ciphers (likely never will) Fixes https://github.com/denoland/deno/issues/21805 --- tests/unit_node/crypto/crypto_cipher_test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/unit_node/crypto/crypto_cipher_test.ts') diff --git a/tests/unit_node/crypto/crypto_cipher_test.ts b/tests/unit_node/crypto/crypto_cipher_test.ts index d22028624..ab8bb4d37 100644 --- a/tests/unit_node/crypto/crypto_cipher_test.ts +++ b/tests/unit_node/crypto/crypto_cipher_test.ts @@ -256,3 +256,25 @@ Deno.test({ ); }, }); + +Deno.test({ + name: "getCiphers", + fn() { + assertEquals(crypto.getCiphers().includes("aes-128-cbc"), true); + }, +}); + +Deno.test({ + name: "getCipherInfo", + fn() { + const info = crypto.getCipherInfo("aes-128-cbc")!; + assertEquals(info.name, "aes-128-cbc"); + assertEquals(info.keyLength, 16); + assertEquals(info.ivLength, 16); + + const info2 = crypto.getCipherInfo("aes128")!; + assertEquals(info2.name, "aes-128-cbc"); + assertEquals(info2.keyLength, 16); + assertEquals(info2.ivLength, 16); + }, +}); -- cgit v1.2.3