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
15.79k stars 477 forks source link

age: add --pinentry flag to use pinentry to read passphrase #386

Closed twpayne closed 2 years ago

twpayne commented 2 years ago

Fixes #182.

This commit uses https://pkg.go.dev/github.com/twpayne/go-pinentry instead of https://pkg.go.dev/github.com/gopasspw/pinentry because the former provides a more complete API, more robust error handling, and correct escape character handling by default.

If this adds too many dependencies, I'd be happy to strip down https://github.com/twpayne/go-pinentry to reduce the dependencies to a minimum.

dominikschulz commented 2 years ago

Author of gopasspw/pinentry here. I do support the proposal to replace gopasspw/pinentry with a different implementation. We have introduced our package for an experimental feature that we currently don't put much focus on. So our pinentry implementation is not our top priority right now (and likely won't be anytime soon). We kept it around primarily because I knew that yubikey-agent was using it.

If go-pinentry looks sane (IMHO it does) age should probably use that instead. And you should consider adopting it for yubikey-agent, too. We'll try to move gopass over to it as well.

twpayne commented 2 years ago

I've updated this to use https://github.com/twpayne/go-pinentry-minimal, which has the same functionality as https://github.com/twpayne/go-pinentry but has no dependencies outside the Go standard library.

FiloSottile commented 2 years ago

Thank you @twpayne for the package, and @dominikschulz for chiming in. I've decided we won't merge alternative password input methods in cmd/age, but we'll ship them all in a separate plugin. I'll make sure to support pinentry there and I'll be using the minimal package like in yubikey-agent. See https://github.com/FiloSottile/age/discussions/256#discussioncomment-2638232 for a bit more details.