From ca02a218b8322f738584b29d35d344a7b6447ee2 Mon Sep 17 00:00:00 2001 From: Lukas Burkhalter Date: Tue, 20 Jun 2023 14:47:57 +0200 Subject: [PATCH] Ensure DecryptSessionKey returns an error for a missing key packet (#245) --- crypto/keyring_session.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/keyring_session.go b/crypto/keyring_session.go index ca2a94f9..638c1f78 100644 --- a/crypto/keyring_session.go +++ b/crypto/keyring_session.go @@ -55,7 +55,11 @@ Loop: } if !hasPacket { - return nil, errors.Wrap(err, "gopenpgp: couldn't find a session key packet") + if err != nil { + return nil, errors.Wrap(err, "gopenpgp: couldn't find a session key packet") + } else { + return nil, errors.New("gopenpgp: couldn't find a session key packet") + } } if decryptErr != nil {