I get the error: 0D07209B: asn1 encoding procedure: ASN1_get_object: too long "when trying to sign an object with the generated PrivateKey in Node.js.
Buf is a simple object encoded using node-cbor
var ecdh = crypto.createECDH('secp256k1')
ecdh.generateKeys()
var sign = crypto.createSign('RSA-SHA256')
sign.update(buf)
var buf_signed = sign.sign('-----BEGIN PRIVATE KEY-----\n' +
ecdh.getPrivateKey('base64') +
'\n-----END PRIVATE KEY-----' +
'\n-----BEGIN CERTIFICATE-----' +
'\n-----END CERTIFICATE-----', 'binary')
Was a certificate strictly required? Is there any missing information in the PEM string?
Any help is appreciated, thanks :)
source
share