From ae74b61b59a5ae5d73abbb631443e5bc46388cd5 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sun, 7 Dec 2025 19:54:29 +0100 Subject: [PATCH] cmd/age,internal/stream: improve error messages --- cmd/age/age.go | 2 +- internal/stream/stream.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/age/age.go b/cmd/age/age.go index 6992dee..58a75fe 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -181,7 +181,7 @@ func main() { } if armorFlag { errorWithHint("-a/--armor can't be used with -d/--decrypt", - "note that armored files are detected automatically") + "note that armored files are detected automatically, try again without -a/--armor") } if passFlag { errorWithHint("-p/--passphrase can't be used with -d/--decrypt", diff --git a/internal/stream/stream.go b/internal/stream/stream.go index 7551274..e781700 100644 --- a/internal/stream/stream.go +++ b/internal/stream/stream.go @@ -118,7 +118,7 @@ func (r *Reader) readChunk() (last bool, err error) { out, err = r.a.Open(outBuf, r.nonce[:], in, nil) } if err != nil { - return false, errors.New("failed to decrypt and authenticate payload chunk") + return false, errors.New("failed to decrypt and authenticate payload chunk, file may be corrupted or tampered with") } incNonce(&r.nonce)