Data encrypted in C# is 1 byte too long to be decrypted in Java

后端 未结 2 1315
自闭症患者
自闭症患者 2021-01-01 08:04

I have a server written in Java which sends converts its RSA key to the XML format used by .NET before sending it to the client:

public String getPublicKeyXM         


        
2条回答
  •  难免孤独
    2021-01-01 08:45

    I found the problem. The BigInteger's toByteArray() function included a leading zero for some reason. I just removed the leading zeros from the array and it now works like a charm!

提交回复
热议问题