Saltpack – A modern crypto messaging format
github.com
github.com
I don't really want my private key file just sitting around in plaintext.
One obvious thing to do is to use age to encrypt that file with a passphrase. I had hoped that if you gave age a passphrase encrypt file in place of a plaintext private key file, it would recognize it and ask for the passphrase, but alas, it does not.
So far, the only way I've found to do this without making a temporary copy of the plaintext private key on disk is to use a FIFO. Given a file, "input", encrypted to my public key, a file, "key.dat" containing my age private key encrypted with a passphrase, this decrypts "input" to the file "output":
$ mkfifo f
$ age -d -i f input > output &
$ age -d key.dat > f
...age prompts for the key.dat passphrase...
Another approach would be to make and mount a RAM disk, decrypt the public key to that, decrypt input, and then unmount and destroy the RAM disk, but that seems more bother, and also less portable. The FIFO trick should work on any modern Unix or Unix-like system.This is assuming I even want a key file. Age keys are quit small. Here's a private key it just made for me: "AGE-SECRET-KEY-15KMEW7TZY2T02V33ZM0MPH65CTTGHFY34DP2PDQDXFZGT3JU8GQQ5GDAYU"
That's small enough that I'd be happy to store all my private keys in my password manager, and copy/paste from there when I need one. The FIFO trick can work with that:
$ age -d -i f input > output &
$ cat > k
...paste in the key...
That echos the private key to the terminal, though, so maybe something like this? $ SAVE=$(stty -g)
$ stty -echo
$ age -d -i f input > output &
$ echo "Paste the key, press RETURN, then control-D"
$ cat > k
$ stty $SAVE
I suppose that can be turned into a little shell script, so not having direct support for encrypt private key files is not too annoying--at least on Unix and Unix-like systems.Is there a reasonable way to do this on Windows?
age -i <(age -d key.dat) -d input > output
if you're using gnu pass to store private keys, you could do something like age -i <(pass age-key-personal) -d input > outputSeems like some of the choices they made were getting bashed, though I'm not sure the reasons were more than personal preferences.
[1] https://news.ycombinator.com/item?id=14067003
Edit:typo
Cannot comment on the crypto part yet, but the general idea is excellent, we need this.
The later very much depends on the email client but the former is less of an issue.
In a worst case using this, you'll be looking at a crash in your client. Code execution is an unlikely issue in Go. The lib doesn't care much about the inside format of the message so that should be a non-issue as well.
I think PGP just gave this sort of messaging format a bad rep because PGP has a bunch of issues related to "being able to cleanly decrypt and encrypt a message".
Notably I've been looking at various modern "safe and easy" crypto tools and found Scuttlebutts handshake interesting. Yet, the entire protocol was a bit difficult to use, and left me with the impression that I'd have to write a lot myself in my preferred language (Rust) to get a batteries included experience. And, for good reason, I'm always hesitant to write anything about crypto hah.
... though, now that I'm looking for a Rust salt pack lib, it doesn't seem to exist in Rust either. Humm.
[1]: https://ssbc.github.io/scuttlebutt-protocol-guide/#handshake
From the protocol end, I heard good things about noise [1] but I haven't seen acual apps make use of it(Edit: It literaly says "Noise is currently used by WhatsApp, WireGuard, Lightning, and I2P." On their page). I highly encourage the author of saltpack to keep a reference list of projects that make use of saltpack.
I do like Saltpack's ASCII armour format better, though.