Update session key decryption to not allow SED packets (#255)

This commit is contained in:
Lukas Burkhalter 2023-10-27 12:10:17 +02:00 committed by GitHub
parent 0eace5479a
commit da4cecfea5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 137 additions and 0 deletions

View file

@ -409,6 +409,11 @@ func decryptStreamWithSessionKey(
// Decrypt data packet
switch p := p.(type) {
case *packet.SymmetricallyEncrypted, *packet.AEADEncrypted:
if symPacket, ok := p.(*packet.SymmetricallyEncrypted); ok {
if !symPacket.IntegrityProtected {
return nil, errors.New("gopenpgp: message is not authenticated")
}
}
dc, err := sk.GetCipherFunc()
if err != nil {
return nil, errors.Wrap(err, "gopenpgp: unable to decrypt with session key")