Bug 500586

Summary: KMail autocrypt header may be to long for Googlemail
Product: [Applications] kmail2 Reporter: Martin Steigerwald <Martin>
Component: cryptoAssignee: kdepim bugs <pim-bugs-null>
Status: REPORTED ---    
Severity: normal CC: progval+bugs.kde.org
Priority: NOR    
Version First Reported In: 6.3.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Martin Steigerwald 2025-02-22 18:18:34 UTC
SUMMARY

Googlemail just said:

<incoming+[…]gitlab.com>: host
    aspmx.l.google.com[…] said: 552-5.3.4 The size of one of the
    header values (48072 bytes) exceeds Google's 552-5.3.4 limit of 32768 bytes
    per individual header size. To view our header 552-5.3.4 size guidelines,
    go to 552 5.3.4  https://support.google.com/a?p=header-limits
    5b1f17b1804b1-439b030d392si26206815e9.171 - gsmtp (in reply to end of DATA
    command)

I wondered what header might have that size: Well it is the Autocrypt header. It seems KMail attaches key data with all signatures.

Googlemail was the only receiver which complained so far, but adding in more than 45 KiB to each mail may indeed a bit much? It adds quite a bunch of overhead to each sent mail. On the other hand GMail is known for imposing artificial restrictions like this (while relaying a ton of spam through their service). I have no final judgment on this on the header size limit.

Maybe add an option to only add key data without signature with Autocrypt? Maybe add a way to enable Autocrypt in the composer to the currently edited mail or for certain recipients in address book?

STEPS TO REPRODUCE

1. Enable Autocrypt. 
2. Make sure Autocrypt header is more than 32768 bytes.
3. Send a mail to/through Googlemail.

OBSERVED RESULT

Mail gets rejected by Googlemail.

EXPECTED RESULT

Mail gets accepted.

(I do not agree with Gitlab.com using Googlemail to begin with but that is out of the scope of this bug report.)

SOFTWARE/OS VERSIONS
Linux: Devuan Ceres
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.11.0
Qt Version: 6.7.2
Comment 1 progval+bugs.kde.org 2025-07-24 10:51:25 UTC
> Maybe add an option to only add key data without signature with Autocrypt?

That would violate section "3.1.1 OpenPGP Based key data" of the Autocrypt spec (https://docs.autocrypt.org/_/downloads/en/main/pdf/). However, in my case KMail seems to be sending lots of signatures that it does not have to (either expired or related to other identities/subkeys)