Command line: how to ecrypt a file (and its decryption too)

Linux terminal encryption comes with openssl:

openssl aes-256-cbc -in input-file.txt -out encrypted.txt -pass pass:somepassword

For the decryption just add the -d switch:

openssl aes-256-cbc -d -out input-file.txt -in encrypted.txt -pass pass:somepassword


the “pass:” before the actual plain text password tells is mandatory. Another option would be “file:” to use the first line of a file as password. Omitting the -pass parameter will result in an interactive prompt asking the password.
OpenSSL supports several encodings and encryption, from base64 to blowfish and so and forth (see man openssl for the full list).

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s