I'm using openwrt 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?


Use Gnupg or P7zip. Both are available as packages on OpenWRT.

With Gnupg, you can either use public-key encryption (you encrypt with one or more public keys and someone with the corresponding private key can decrypt) (gpg -e), or encryption with a key that's derived from a password (gpg -c). GnuPG doesn't actually use AES by default, but that's irrelevant.

With p7zip, run 7z -mem=AES128 -p archive.zip myfile. Beware that the password will end up in your shell history and can be seen by other users on the same machine if they run ps while the 7z process is running. Note that if you forget the -p option, 7z produces a non-encrypted archive.

Do not use the zip command or the ZipCrypto method of p7zip. It produces encrypted zip files with an ancient, broken encryption algorithm.

Do not use the openssl command. Although it can use AES-CBC (in addition to a number of insecure algorithms such as DES-* or *-ECB), the way it generates a key from a password is broken (even if you salt it, which is not the case by default, it's too slow, so it's easy to brute force).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.