javax.crypto.IllegalBlockSizeException: Data must not be longer than 53 bytes i know that it is because of the RSA algorithm can only encrypt data that has a maximum byte length of the RSA key length in bits divided with eight minus eleven padding bytes, i.e. number of maximum bytes = key length in bits / 8 - 11.
Here am using a 512 key size so it is not allowing more than 53.but i need to maintain 512 bit key but to encrypt more than 53 byte is there any possibility .
Yes and no. You can't encrypt with RSA, but you can go with one of the following:
Do the usual approach of encrypting with symmetric algorithm and passing the key encrypted with RSA. For example, to send data D to another man with public key PK:
The other side open PK(K) to get K, and open K(D) to get D.
split the data into small pieces and encrypt each one separately.
The first approach is a much better one for two main reasons:
(3. There must be a reason why PGP is so common...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With