I'm using the OpenWrt Linux distribution and I want to encrypt a file using AES.
How can I do that quickly and easily, and how can I—or someone else—decrypt it again?
I'm using the OpenWrt Linux distribution and I want to encrypt a file using AES.
How can I do that quickly and easily, and how can I—or someone else—decrypt it again?
The quickest and easiest way is to use openssl
util (provided by openssl-util
package). For example, to encrypt a file, issue the following command:
openssl enc -aes-256-cbc -in file.txt -out file.enc
To decrypt:
openssl enc -d -aes-256-cbc -in file.enc -out file.dec
The openssl
encryption is not a good solution according to this, so please don't use it.
I've used https://www.aescrypt.com/ in the past and I was happy with it. If you want something that has been around for a while - that's not a bad start. It also has both a UI and a cli.
The fact that there is no small, easy to use and super simple cli tool for this purpose annoyed me so much that I sat down and wrote this https://github.com/ro-tex/aes256cli. I literally wrote it while this discussion was open on my screen, so I'm making no claims as to how good of a solution it is. I just wanted something that will do what I need with zero friction and this is good enough for me.
To encode:
cat 'yourfile' | openssl aes-128-cbc > 'encrypted file'
To decode: First, you have to remember your password which you used to encode, then:
cat 'encrypted file' | openssl enc -d -aes-128-cbc -k 'Your password' > 'decrypted file'