test.iso is a large file ,almost as large as 3G.
ls -al test.iso
-rw-r--r-- 1 debian8 debian8 3076767744 Apr 21 10:56 test.iso
1.Encrypting with gpg. I created pub key and provate key for person1.
gpg --gen-key
gpg --list-keys
/home/debian8/.gnupg/pubring.gpg
pub 2048R/410AA390 2017-04-20
uid person1 (person1) <[email protected]>
sub 2048R/FB3A9563 2017-04-20
pub 1024R/C612A324 2017-04-20
uid person2 (person2) <[email protected]>
sub 1024R/F4E12749 2017-04-20
Now to encrypt it with person2' pub key.
time gpg -r C612A324 -o test.iso.gpgasc --encrypt test.iso
real 2m28.337s
user 2m3.752s
sys 0m3.520s
It cost me 2.28 minutes to encrypt the test.iso,i want to do the same task with openssl.
2.Encypting with openssl
openssl genrsa -out private.pem 1024
openssl rsa -in private.pem -pubout -out public.pem
openssl rsautl -encrypt -pubin -inkey public.pem -in test.iso -out test.iso.opensslasc
RSA operation error
139916816565904:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for key size:rsa_pk1.c:153:
1.Does it mean that gpg is better than openssl to encrypt large file?
2.How to fix my openssl command to encrypt with RSA method?
smime
andcms
commands, including hybrid encryption similar to PGP: the data is symmetrically encrypted under a nonce key (DEK) which is RSA-encrypted under the recipient's X.509 certificate (vs the recipient's signed-public-key for PGP). Note OpenSSL S/MIME always and CMS by default base64-encodes the output making it about 33% larger; GPG does this if you use-a/--armor
but not by default.