[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iaik-jce] Using RSA for encryption



When you use rsa key for encryption you can encrypt only the same number of byte like the key length
(if 1024 bits you can encrypt 128 bytes minus the padding).You must use a simmetric algorithm like
triple des for large data encryption  then encrypt the des key with the rsa key. In decryption you
can decrypt the des key use the rsa key, then use the decrypted des key for data decryption.


--
Petruzzi Francesco - Openfor s.r.l.
--
via Faravelli, 8 - 20149 Milano (Italy)
phone:(+39)0234534545 - fax:(+39)0234534065
--


Andrew Smith wrote:

> Hi
>
> When using the RSA algorithm to encrypt some data I am getting the
> following exceptions:
>
> If I use Cipher.doFinal(byte[]) then I get:
>
>    javax.crypto.BadPaddingException: Data is too long.
>
> and then I try to use Cipher.update(byte[]) to avoid the problem and get:
>
>    java.lang.RuntimeException: RSA algorithm does not implement engineUpdate
>
> Could anyone advise my of a way to encrypt of data using RSA as the
> algorithm (I have to use RSA as I have to use a specific key, which is
> an RSA key).  I have tried using my code with a simple string and it
> works fine.  The data I am attempting to encrypt are 4-16KB large zip files.
>
> Thanks in advance
>
> Andrew
>
> --
> Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html
>
> To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce
>



--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce