Quick AES encryption and decryption

For situations when Keybase is not an option. Should work on Ubuntu.

 Generate a AES key

Choose a unique passphrase, <passphrase>.

openssl enc -aes-128-cbc -k <passphrase> -P -md sha1

Keep the iv and key values in the $IV and $KEY environment variables.

 File encryption

Your file is located as file.txt, and will be encrypted as file.txt.enc.

openssl enc -aes-128-cbc -in file.txt -out file.txt.enc -K "$KEY" -iv "$IV"

 File decryption

Your encrypted file is located as file.txt.enc, and will be decrypted as file.txt.dec.

openssl enc -d -aes-128-cbc -in file.txt.enc -out file.txt.dec -K "$KEY" -iv "$IV"
 
0
Kudos
 
0
Kudos

Now read this

First steps

I’ve been looking to start a blog for a long time now, but couldn’t just push myself to do it ; mostly by fear that that my content isn’t relevant enough. I’ve been studying software engineering for two years now - including a 6-month... Continue →