Add EncryptReader
Add EncryptReader function to encrypt io.Reader (pull-based encryption) and use it in cmd/age to get rid of io.Copy.
Updates #644
This PR is nice and we need it, would it make sense to add this?
func EncryptStream(src io.Reader, recipients ... Recipient) (dst io.Reader, error) {
pr, pw := io.Pipe()
return pr, EncryptReader(pw, src, recipients...)
}
We wrap it currently as: https://gitlab.com/data-custodian/custodian/-/blob/88e7389ec5b837672f2b76fd82aaed68a4145e72/components/lib-common/pkg/crypto/reader.go
This PR is nice and we need it, would it make sense to add this?
I think this won't work as writes to pipe will block without corresponding reads.
This PR adds a handy function but what you are looking for is the implementation of https://github.com/FiloSottile/age/issues/644