I\'m using RSA encrypt text and decrypt text. The public key and the private key are generated with openssl tool. I encountered an \"java.lang.ArrayIndexOutOfBoundsException
Usually, you generate a random secret key for a symmetric cipher (like AES) and use this to encrypt your pay load.
RSA is then only used to encrypt this random key. This does not only solve the length problem but has some other advantages as well: