For symmetric encryption you could use enc(1)
which is part of openssl. To encrypt a file with aes256-xts cipher:
openssl enc -aes-256-xts -in foo.txt -out foo.txt.enc
And to decrypt it:
openssl enc -d -aes-256-xts -in foo.txt.enc -out foo.txt
Pretty easy huh?
One other neat feature is that it supports base64
which means it'll use only ascii characters. Just add -a
to the list of arguments and then look at the encrypted file.
enc(1)
is a versatile program. I use it often when I quickly want to copy a file or a small compressed tar archive from one terminal screen to the other, I simply only use base64
.
Let's say I want to quickly copy a directory /home/drumfire/test
which contains a few files, and can't use scp
or other tools. It's trivial to run this through a compression program and encode it:
tar cf - /home/drumfire/test | xz -9ec | openssl enc -a
The result is a blob of ascii text. I select to copy it, and then on the target system I can simply do:
openssl enc -a -d | xz -dc | tar xvf -
In this case Openssl
will wait for input from stdin
. so I hit Shift+Insert which pastes the text, then I press press CTRL+D two times and voila, it extracts.
Neat stuff. B-)