RSA Java encryption and Node.js decryption is not working

后端 未结 1 1047
悲&欢浪女
悲&欢浪女 2021-02-04 14:59

I have a system that requires a RSA keypair to be generated in javascript, have the public key then stored in a database at the server side (as a string), then the server side w

相关标签:
1条回答
  • 2021-02-04 15:30

    Oh i found the solution. It was a difference in the encryption method.

    I just had to initialize Cipher with

    Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
    

    instead of

    Cipher.getInstance("RSA");
    

    to match node-rsa

    0 讨论(0)
提交回复
热议问题