A: This depends on if you want symmetric or asymmetric encryption.
For symmetic encryption, you can use the following…
To encrypt:
> openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt this, you can use the following.
> openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
Now, for Asymmetric encryption you must first generate your private key and extract the public key.
> openssl genrsa -des3 -out private.key 4096 > openssl -in private.key -pubout -out public.key
To encrypt:
> openssl rsautl -encrypt -pubin -inkey public.key -in plaintext.txt -out encrypted.txt
To decrypt:
> openssl rsautl -decrypt -inkey private.key -in encrypted.txt -out plaintext.txt

It is hard to see the whole command-line and it requires scrolling ;(
Please make it go away!
Pingback: openssl file encryption « Morgen Free's Blog
Pingback: encrypted files
Unfortunately, the rsautl command lines only work for very small files. For larger files I get this error:
4052:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too large for key size:rsa_pk1.c:151
See http://blog.altudov.com/2010/09/27/using-openssl-for-asymmetric-encryption-of-backups/ for an alternative.
Pingback: zean.no-ip.info » How do I use OpenSSL to encrypt files?