For symmetric encryption
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
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
openssl rsautl -encrypt -pubin -inkey public.key \
-in plaintext.txt -out encrypted.txt
openssl rsautl -decrypt -inkey private.key \
-in encrypted.txt -out plaintext.txt