I am looking for a code sample to multiple-part encrypt a String which is larger than the limit allowed by RSA.
I'm assuming it can be done with the doFinal and update methods of the Cipher object but couldn't get it to work.
Most folks don't do it that way. RSA only works on blocks of the key length. The normal approach is to generate a random number/nonce, encrypt it with RSA and send it. Then use that random nonce to encipher the long string, send that too. On the receiving end, use RSA to decrypt the nonce, and use it to decrypt the rest of the message.
We find this kind of rampant individuality very disturbing. But not this tiny ad: