FiloSottile / age

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.
https://age-encryption.org
BSD 3-Clause "New" or "Revised" License
16.83k stars 492 forks source link

age: add ParseRecipients #158

Closed sylr closed 3 years ago

sylr commented 3 years ago

Add a ParseRecipients which can read a file containing one public key per line.

It also supports extracting public keys from the output of age-keygen.

Signed-off-by: Sylvain Rabot sylvain@abstraction.fr

codesoap commented 3 years ago

As I wrote at https://github.com/FiloSottile/age/pull/165#issuecomment-753295900, I think this is not a feature age needs. The age tool can be made to use public keys from a file like testdata/keys2.txt like this:

awk 'match($0,/age1.+/) {print "-r", substr($0, RSTART, RLENGTH)}' testdata/keys2.txt | xargs -J % age % -o data.age data

I also don't see the need for the new ParseRecipients() function, since I feel like this is as too "special"/unintuitive to be part of the official interface. I feel like this should be implemented in a separate library, if needed.

FiloSottile commented 3 years ago

Hi! Thank you for contributing! I took a different path in #173, but it was useful to look at open PRs for the users' expectations. Let me know if that implementation works for you!

I wrote up an explanation of why I ended up implementing recipient files and not HTTPS sources on the mailing list, and I appreciate feedback! https://groups.google.com/g/age-dev/c/StmWsOyb-H8/m/a44rSBIWCAAJ