-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error message for decryption with a session key #237
Conversation
bd40c5c
to
f88b68e
Compare
f88b68e
to
e0431bc
Compare
@@ -819,7 +819,7 @@ func TestCorruptedMessageInvalidSigHeader(t *testing.T) { | |||
promptFunc := func(keys []Key, symmetric bool) ([]byte, error) { | |||
return passphrase, nil | |||
} | |||
const expectedErr string = "openpgp: invalid data: parsing error" | |||
const expectedErr string = "openpgp: decryption with session key failed: parsing error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add similar tests for SEIPDv2 to test (and "demo") what kind of errors are thrown with AEAD (hopefully the AEAD chunks are not released/parsed even with streaming).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test for a missing last aead authentication tag:
6525f78
32d52e6
to
89db31a
Compare
89db31a
to
b13d2fd
Compare
b13d2fd
to
c895e57
Compare
This PR enhances the error messages returned during decryption with a session key by adding more context to improve clarity. Currently, a generic error like
openpgp: invalid data: parsing error
is returned, which makes it difficult to pinpoint the specific stage of failure and determine whether the session key itself is incorrect.With this PR, the error message now includes additional context, for example:
openpgp: decryption with session key failed: parsing error
. This change helps identify the context the error occurs in while retaining the generic parsing error to avoid oracle attacks (#78).Further, it refactors the error handling slightly to avoid repetitions.