Encrypt:

openssl enc -aes-256-cbc -a -salt -in plain.txt -out encrypted.enc

Decrypt:

openssl enc -d -aes-256-cbc -a -in encrypted.enc -out plain.txt

Functions:

#!/bin/bash
function encrypt()      { openssl enc -aes-256-cbc -a -salt -in $1 -out ${1}.enc ; stat $_ ; } 
function decrypt()      { openssl enc -d -aes-256-cbc -a -in $1 -out $( echo $1 | sed 's/.enc$//' ) ; stat $_ ; } 

By karlo