And they both attempt to be simpler, more modern than gnupg[3] and easier to use than eg: openssl[4].
Which tool do you use/recommend for encrypting files, and why?
My primary use case is for backups - but interested in other use-cases as well.
[1] https://github.com/opencoff/sigtool
age has a stable spec [1] and an alternative implementation in Rust [2] based on the spec with extensive interop tests.
If that’s just not visible, I’d be interested in how to fix that appearance, too!
[0]: https://words.filippo.io/restic-cryptography/
If you want file encryption, gpg -c (AES 256) or gpg -e (cv25519, optionally signed with ed25519). Frankly, there are tons of choices for file encryption.
If you want file system encryption, ZFS native encryption. There is fscrypt for other Linux file systems, but it doesn’t support authenticated encryption AFAIK.
If you want disk encryption, LUKS. Better yet, use file system encryption with a better mode and authenticated encryption.
If you want per file encryption of a directory, consider rclone which uses secret box from NACL (or gocryptfs which uses OpenSSL). There are many other options such as cryptomator (written in Java), but I can’t confirm them!
But a related question: how to handle long-term usage?
I mean, I had some scripts which were essentially using "openssl enc -bf -salt" and this has worked fine for more than a decade. But at some point (I think when OpenSSL went from 1.1.0 to 1.1.1), OpenSSL started generating a warning about "deprecated key derivation" and suggesting "using -iter or -pbkdf2". Now, I can obviously update the scripts, but then the need to start storing metadata arises: this file was encrypted with this method, but this one with the other method.
I am confident that such issues arise with any long-running process. How to cope with the issue?
Decrypt: gpg file.zip.gpg
However, for my personal files on my computer, I use a Veracrypt container with a strong password and custom pin.
I've heard great criticism of directly using the RSA functions, but they do work for the exchange of a very small amount of data.
Newer versions of OpenSSL offer chacha20-poly1305 in the "enc" symmetric ciphers.
https://www.linuxjournal.com/content/flat-file-encryption-op...
I use p7zip for encrypted backups, even though the AES implementation is far from best practice.
https://piunikaweb.com/2019/02/01/insecure-aes-crypto-implem...
The main reason is the ability to use physical smartcards for encryption (or the openPGP applet on a yubikey). Until 'age' can match that, it is no alternative for me.
https://blogs.sap.com/2022/04/23/how-to-encrypt-and-decrypt-...
For anything critical, I try to avoid tools that are neat/cool but developed by small teams or individuals where the maintenance could suddenly disappear, which is common.
This is more of a one-off tar czf - $HOME | encrypt > /mnt/usbstick.tgz.enc type thing - or for sharing encrypted files.
But I agree 7zip is a decent option for the latter.
restic -r sftp:: --password-command="pass mybackup" backup
https://restic.readthedocs.io/en/latest/