deno icon indicating copy to clipboard operation
deno copied to clipboard

crypto.createCipheriv('aes-256-ctr', …) fails with `Unknown cipher`

Open joewalker opened this issue 6 months ago • 6 comments

Version: Deno 1.45.5

Usage context: Trying to port code from nodejs which uses ssh2. The ssh2 library is attempting to decode an ssh private key.

The failure appears to come from Deno's cipher.ts:

this.#context = op_node_create_decipheriv(cipher, toU8(key), toU8(iv));
this.#needsBlockCache = !(cipher == "aes-128-gcm" || cipher == "aes-256-gcm");
if (this.#context == 0) {
  throw new TypeError("Unknown cipher");
}

In this case op_node_create_decipheriv is called with cipher=aes-256-ctr.

joewalker avatar Aug 03 '24 12:08 joewalker