crypto.getCiphers() - Why are a different set of algorithms available via NodeJS (v12.18.3) versus ElectronJS via (NodeJS 12.14.1)?

Viewed 204

Take a look at the NodeJS documentation for version 12.18.3 for the crypto.createCipheriv() method.

The method takes 3 required params:

  1. algorithm (string representing algo used to encrypt data)
  2. key (string or buffer representing "password" for encryption)
  3. iv (string or buffer representing initialization vector)

Algorithm String

The site also explains that the values for the Algorithm string can be obtained by running a terminal command : $ openssl list -cipher-algorithms

Unfortunately, there is no other documentation about the string values for algorithm parameter at the site.

List of 175 Algorithms Available on My Machine

So far, all is good. I ran the terminal command and I get a list of 175 encryption algorithms that are available. They look something like the following:

AES-128-CBC
AES-128-CBC-HMAC-SHA1
AES-128-CBC-HMAC-SHA256
id-aes128-CCM
AES-128-CFB
AES-128-CFB1
AES-128-CFB8
AES-128-CTR
AES-128-ECB
id-aes128-GCM
AES-128-OCB
AES-128-OFB
AES-128-XTS
AES-192-CBC
id-aes192-CCM
AES-192-CFB
AES-192-CFB1
AES-192-CFB8
AES-192-CTR
AES-192-ECB
id-aes192-GCM
AES-192-OCB
AES-192-OFB
AES-256-CBC
...

Node v12.18.3

When I set up the appropriate items and run another NodeJS crypto algorithm from a sample app called crypto.getCiphers() I see the exact same list of 175 algorithms. This runs with the default Node version on my machine v12.18.3.

Node Under Electron : v12.14.1

However, when I call that same method from within my ElectonJS app running Node v12.14.1 and Electron 9.3.0, I only see 24 algorithms listed.

No Documentation and No Explanation to the Difference

However, there is no documentation that this slightly different version of Node would return anything different than the list that is available on my machine.

Questions

Why does Node v12.14.1 via Electron only give me the list of 24? Where is that list coming from? Can anyone show me where that might be documented?

Here's a snapshot of the Electron app displaying the versions and displaying the call to crypto.getCiphers():

electron and crypto.getCiphers()

This problem became apparent when I could *run official Node example code using the algorithm string "aes256" via node v12.18.3 but could not run the code via electron / node v12.4.1, because the "aes256" algorithm wasn't available. That sample code includes the following line : crypto.createCipheriv("aes256", key, resizedIV)

Update

Had to come back and add the following as part of this question. I successfully got the data encrypted using the appropriate algorithm (aes-256-cbc) and now as I'm decrypting the data in my ElectronJS app I get the following error:

openssl reference

My point here is that the error that shows up references OPENSSL from within the ElectronJS app, even though (most likely - from posted comment) Electron actually uses BoringSSL. I suppose to understand this stuff you have to be a Rocket Scientist and a Brain Surgeon. xD

0 Answers
Related