How can I encrypt a large file with a public key so that no one other than who has the private key be able to decrypt it? I don't want to use GPG!
This could be used to encrpyt a file
mypic.png, given you already have a private/public keypair in
ccbild-crt.pem. (You can find a guide to creating a keypair in this answer.)
# encrypt openssl smime -encrypt -aes-256-cbc -binary -in mypic.png -outform DER -out mypic.png.der ccbild-crt.pem # decrypt openssl smime -decrypt -binary -in mypic.png.der -inform DER -out mypic.png -inkey ccbild-key.pem
Note that the settings may not reflect best practice in selection of crypto standard (in particular if you read this in the future), also it might not be a good choice performance-wise. (We only use it for sub-1M files in our application.)
Since you want to encrytpt a file - you can use GPG for this purpose.
Also, don't worry about the format of file - gpg can encrypt any file.
gpg-agent -s --daemon --write-env-file --use-standard-socket
Generate your key:
Select default ke, unless you know what you're doing, or are told otherwise by someone who does. If asked for keysize, enter 1024.(size in bits)
When GPG will say that it will generate your key, start pressing keyboard randomly(just avoid combinations that send signals, like CTRL + Z, etc.
You are ready to decrypt file. By default you use
gpg -e -r user_id my_file
Replace user_id with email provided during key generation. Instructions based on Indiana University's article