age

Simple, secure encryption with UNIX-style composability.
git clone git://git.sgregoratto.me/age
Log | Files | Refs | README | LICENSE

commit 37d95cc84a986bf2582b3daf9a5aa5db009ecfe1
parent e9c118cea0a3c7b24c789d4150f2d6f2d09fd525
Author: Filippo Valsorda <hi@filippo.io>
Date:   Sun,  6 Oct 2019 21:57:26 -0400

all: remove AEAD marker

As Thomas convinced me, we can always add it back by bumping the
version, but the fewest knobs and joints we start with, the better.

Diffstat:
Minternal/age/age.go | 5-----
Minternal/format/format.go | 8+++-----
2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/internal/age/age.go b/internal/age/age.go @@ -32,8 +32,6 @@ func Encrypt(dst io.Writer, recipients ...Recipient) (io.WriteCloser, error) { } hdr := &format.Header{} - // TODO: remove the AEAD marker from v1. - hdr.AEAD = "ChaChaPoly" for i, r := range recipients { if r.Type() == "scrypt" && len(recipients) != 1 { return nil, errors.New("an scrypt recipient must be the only one") @@ -74,9 +72,6 @@ func Decrypt(src io.Reader, identities ...Identity) (io.Reader, error) { if err != nil { return nil, fmt.Errorf("failed to read header: %v", err) } - if hdr.AEAD != "ChaChaPoly" { - return nil, fmt.Errorf("unsupported AEAD: %v", hdr.AEAD) - } if len(hdr.Recipients) > 20 { return nil, errors.New("too many recipients") } diff --git a/internal/format/format.go b/internal/format/format.go @@ -12,7 +12,6 @@ import ( type Header struct { Recipients []*Recipient - AEAD string MAC []byte } @@ -61,7 +60,7 @@ func (h *Header) MarshalWithoutMAC(w io.Writer) error { return err } } - _, err := fmt.Fprintf(w, "%s %s", footerPrefix, h.AEAD) + _, err := fmt.Fprintf(w, "%s", footerPrefix) return err } @@ -107,11 +106,10 @@ func Parse(input io.Reader) (*Header, io.Reader, error) { if bytes.HasPrefix(line, footerPrefix) { prefix, args := splitArgs(line) - if prefix != string(footerPrefix) || len(args) != 2 { + if prefix != string(footerPrefix) || len(args) != 1 { return nil, nil, errorf("malformed closing line: %q", line) } - h.AEAD = args[0] - h.MAC, err = DecodeString(args[1]) + h.MAC, err = DecodeString(args[0]) if err != nil { return nil, nil, errorf("malformed closing line %q: %v", line, err) }