I encrypt the message and then decrypt it. Here is the gist: https://gist.github.com/2489899 . I have to store these keys in an xml scheme, because the message must also decrypt in C #. (This is just a "summary" of my program with a dam, etc.). But I always get an exception:
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)
source
share