Roughly keysize - paddingsize is the limit. keysize in your case is 512 bytes and padding size for OAEP padding (the common standard) is ~41, so the limit is about 471 bytes.

Usually when encrypting a file, you use a symmetric cipher with a randomly chosen key, and then encrypt the key with RSA and prepend that to the encrypted file.

                -chris


On 06/27/2011 09:00 AM, ml.vladimbe...@gmail.com wrote:
Hello.
I tried to encrypt a file(1Mb), with RSA private key of 4096-bit length with command:

openssl rsautl -encrypt -pubin -inkey rsapublickey.pem -in 2.txt -out 2.srsa

I get next error:

Loading 'screen' into random state - done
RSA operation error
5616:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for
key size:.\crypto\rsa\rsa_pk1.c:151:
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to