on java side:
use bouncycastle to get the key pair, privateKey and publicKey
encrypt orig message1 with privateKey to get a encrypted message2
decrypt encrypted message2 with publicKey is ok, success to get the same orig message1
on c++ side:
based on openssl, "RSA_public_decrypt" and "RSA_private_encrypt" API
use the same publicKey(which generated on java side) to decryt the message2, return a buffer with every byte filled 0, and the RSA_public_decrypt return success.
in addition:
on c++ side, if use the privateKey to encrypt the orig message1 to get a encrypted message3, and then decrypt it with public key, success to get message1. but the message3 is not the same to the encrypted message2(java side).
all the above used RSA_NO_PADDING
on java side, encryted more times, get the same message2
on c++ side, encrypted more times, get the same message3 too. but message2 not same to message3.
the question is how to decrypt on c++ side to get the orig message1 wich encrypted on java side?
thanks!