i need some help for solve my problem.
Problem : I want to encrypt a number (A) with public RSA Key from Android platform and then decrypt it on PHP Server with the
There are a lot of places this can go wrong:
X509EncodedKeySpec
, most of which are 0. Are you sure you are getting the proper public key?in
String? String.getBytes()
uses the platform default encoding and may have unintended results. Use getBytes("ASCII")
or getBytes("UTF-8")
. Generally, you should just use SSL, and don't try to implement asymmetric encryption yourself.