我加密一条消息,然后解密它。这是要点:https ://gist.github.com/2489899 。我必须将此密钥存储在 xml 方案中,因为消息也应该能够在 c# 中解密。(这只是我的程序与数据库等的“摘要”)。但我总是得到例外:
javax.crypto.BadPaddingException: Data must start with zero
at sun.security.rsa.RSAPadding.unpadV15(RSAPadding.java:308)
at sun.security.rsa.RSAPadding.unpad(RSAPadding.java:255)
at com.sun.crypto.provider.RSACipher.a(DashoA13*..)
at com.sun.crypto.provider.RSACipher.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
at Main.decrypt(Main.java:50)
at Main.main(Main.java:24)