rzcoder/node-rsa

ERROR InvalidAsn1Error: encoding too long

shivam1747 opened this issue · 3 comments

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

Did you end up finding the solution for it ? I am currently experiencing the same error message.

Any update about this problem?

check you don't have \ns in the key