titi toto wrote:

Hi,
Sorry if my question is stupid... :-)
I'm trying to use openssl cryptographic functions to cipher data with RSA algorithm, with a keysize of 1024 bits.
When my data size is larger thant 1024 bits, the function RSA_public_encrypt sends back an RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE error message.
To my understanding, RSA should be able to cipher data larger than keysize, but the error message seems to say the opposite.
Am i missing something ?

RSA is a block cipher and as such encrypts data in multiples of its blocksize (which is in most cases the keysize).
Usually you don't encrypt much data with RSA (or other public key algorithms) because these algorithms are "expensive", so the usual way is to generate a random key for a symmetric algorithm (3DES, CAST, IDEA, ...), use this key to encrypt the bulk of your message, then encrypt the symmetric key with RSA and attach (or prepend) the encrypted symmetric key to the symmetric encrypted data.

Hope this helps,
Ted
;)

--
PGP Public Key Information
Download complete Key from http://www.convey.de/ted/tedkey_convey.asc
Key fingerprint = 31B0 E029 BCF9 6605 DAC1  B2E1 0CC8 70F4 7AFB 8D26


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to