help
help copied to clipboard
Error loading ED25519 private key
Details
I am trying to generate a signature using a ED25519 private key generated using Java, but crypto.sign() fails with error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag.
If I use a key without PublicKeyInfo it works as expected. Is this a known limitation?
Sample keys
- With public key info (fails):
MFECAQEwBQYDK2VwBCIEINBDvg6qKDOPHPceQ+umB25RtZ8/fF5kUyYky4V8BikLgSEAj6KwvhLnGSLW9P+BSlfqpIeAprW2Aq9OJvP8jkArE58= - Without public key info, taken from here (works):
MC4CAQAwBQYDK2VwBCIEIJ+DYvh6SEqVTm50DFtMDoQikTmiCqirVv9mWG9qfSnF
Node.js version
- 16.13.2
- 18.10.0
Example code
crypto.sign(undefined, Buffer.from('test'), <PEM-encoded-private-key>);
Operating system
macOS
Scope
Runtime
Module and version
crypto