openssl rsautl -encrypt -pubin -inkey public.pem -in LargeFile.zip -out LargeFile_encrypted.zip
It generates the following error:
RSA operation error:
3020:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for key size:.\crypto\rsa\rsa_pk1.c:151:
The Solution is SMIME.
1) Generate private and public keys.
openssl req -x509 -nodes -days 100000 -newkey rsa:2048 -keyout privatekey.pem -out publickey.pem -subj ‘/’
2) Encrypt seemingly endless amount of data.
openssl smime -encrypt -aes256 -in LargeFile.zip -binary -outform DEM -out LargeFile_encrypted.zip publickey.pem
3) Decrypt
openssl smime -decrypt -in LargeFile_encrypted.zip -binary -inform DEM -inkey privatekey.pem -out LargeFile.zip
=>That's all !! ;)