ERROR InvalidAsn1Error: encoding too long
shivam1747 opened this issue · 3 comments
shivam1747 commented
keyData = '-----BEGIN RSA PRIVATE KEY-----\n' + my private key + '\n-----END RSA PRIVATE KEY-----';
key = new NodeRSA({b:2048});
encrypt(text){
key.importKey(keyData, 'pkcs1');
encrypted = this.key.encrypt(plainText, 'base64');
}
Pops out an error : ERROR InvalidAsn1Error: encoding too long
miguelpicocecropiasolution commented
Did you end up finding the solution for it ? I am currently experiencing the same error message.
arminhupka commented
Any update about this problem?
nicoabie commented
check you don't have \ns in the key