RSA Android Encrypt / RSA PHP Decrypt

前端 未结 1 1263
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 02:13

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

相关标签:
1条回答
  • 2020-12-15 02:48

    There are a lot of places this can go wrong:

    1. You are passing 5000 bytes to X509EncodedKeySpec, most of which are 0. Are you sure you are getting the proper public key?
    2. How long is the in String?
    3. 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.

    0 讨论(0)
提交回复
热议问题