node-rsa errors when trying to decrypt message with private key

后端 未结 3 526
北海茫月
北海茫月 2020-12-16 05:38

So I\'ve been trying to use node with node-rsa and javascript with jsencrypt to create a website (for an assignment) where the javascript client gets the public key generate

3条回答
  •  猫巷女王i
    2020-12-16 06:12

    To answer your question @Curious_Programmer be default node-rsa uses pkcs1_oaep for encryption and decryption while jsencrypt uses pkcs1. Thankfully node lets you change the encryptionScheme, what you need to do is add ...

    myDecrypter.setOptions({encryptionScheme: 'pkcs1'});
    

    under

    var myDecrypter = new NodeRSA({b: 512});
    

    and all will work like a charm, I hoped I helped you ;)

提交回复
热议问题