-
Notifications
You must be signed in to change notification settings - Fork 300
Closed as not planned
Closed as not planned
Copy link
Description
Details
I'm writing this issue here to prevent other people from finding it in other repos or frmo other libraries.
The initial discussion was found on this issue but should continue here in my opinion since this is an error with how node handles cryptography and not library-specific.
This is what I know, if anyone has any more details they would be greatly appreciated!
- this error code does not seem to exist in node js itself
- this error is a reference to OpenSSL and it looks like it means that a cryptography algorithm unknown to openssl was used from a nodejs runtime
- This error is certainly bubbled up from OpenSSL itself (I'm guessing from somewhere around here)
I have encountered this error myself trying to verify a signature, the most probable cause was a bad publicKey passed like so:
const verifier = crypto.createVerify('sha256');
verifier.update('some data');
verifier.verify(publicKey, 'signature to verify against');
I would advice anyone reading this, if you are using any type of cryptography:
- check your public/private keys and the imports/transformations/buffers you make from/to them
- if using a SDK check the documentation for the necessary keys - or if they're not necessary (I've seen many posts talking about Google APIs SDK)
Node.js version
v19.7.0
but should happen in many other versions (probably 16+)
Example code
This fails on Nodejs v19.7.0
const verifier = crypto.createVerify('sha256');
verifier.update('test');
verifier.verify('public-key', 'fake-signature');
Operating system
MacOS 13.2.1
Scope
runtime + dependencies
Module and version
Not applicable.
karray, oviniciusfeitosa, akhil, manhvu-getcerebral, AzkaLufthansa and 1 more