For Programmers: Free Programming Magazines  


Home > Archive > Java Security > June 2005 > IllegalBlockSizeException









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author IllegalBlockSizeException
Tumzadoc

2005-06-10, 8:58 am

Hi
I'm trying to encrypt a 256 bytes of data using a 2048 bits RSA key.
----Code Snippet----
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, rsaPublic);
encryptedData = cipher.doFinal(originalData);
----End of Code Snippet----

It gives me the following exception :
javax.crypto.IllegalBlockSizeException: Data must not be longer than 245
bytes

Is it possible to encrypt data of over 246 bytes using RSA? If yes how do
i go about doing it

Thanx

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com