ArrayIndexOutOfBoundsException : too much data for RSA block

后端 未结 2 1991
名媛妹妹
名媛妹妹 2020-12-09 06:58

I have some problem with my android application. I am trying to an app related with RSA encryption/decryption.this is my problem:

I can encrypt short sentences clear

2条回答
  •  庸人自扰
    2020-12-09 07:22

    In my use case, I need to encrypt some request data to server, from my app.

    If I encrypt the AES key with RSA, that's kind of meaningless because the point of using RSA instead of AES, is to prevent reverse-engineering to get the AES key (versus RSA needs a private key stored in server for decryption). Since the AES key needs to be stored in the app locally, I cannot use the approach as suggested by erickson.

    Instead, I split the long string into List (Each length suggested by server provider); and encrypt each String.

    After that, the List is passed to server in a json array, and let server decrypt each and re-join them.

    Of course, this approach needs your server's support, and can potentially has performance issue.

提交回复
热议问题