[ DKIM ]

Simple and relaxed DKIM canonicalisation: what changes can survive

Identify the normalization a signature permits, reproduce it on preserved bytes and locate changes that remain outside its protection.

By the EmailAuth research team

[ Key points ]

  • Read header/body algorithms separately; absent c defaults to simple/simple.
  • Relaxed rules normalize specified whitespace, not substantive message edits.
  • Empty-body handling differs: simple hashes CRLF; relaxed hashes zero octets.
On this page

DKIM canonicalization defines how message bytes are prepared for hashing and signature verification. It allows specific normalizations; it does not make arbitrary message editing harmless. Diagnose the actual signature's settings and raw content before changing the sender's configuration.

Read the two settings separately

The signature's c= tag names header and body canonicalization in that order. For example, relaxed/simple uses relaxed processing for headers and simple processing for the body. RFC 6376 §3.5 defines simple/simple as the default when the tag is absent; if only the header algorithm is stated, the body algorithm defaults to simple.

Record c=, the signed-header list h=, the body hash bh= and any body-length limit l= alongside d= and s=. A body-hash mismatch, a header-signature mismatch and a missing public key need different investigations. Do not infer the canonicalization setting from what the mail client displays.

Understand the permitted normalization

Simple header canonicalization preserves header fields as presented to the algorithm. Relaxed header processing lowercases field names, unfolds continuation lines and normalizes specified whitespace. It does not lowercase field values or authorise changing a Subject's words.

Simple body canonicalization removes empty lines at the end and ensures the required final CRLF, while retaining other body content. Relaxed body processing also reduces runs of spaces and tabs within a line and removes whitespace at line ends before handling trailing empty lines. It does not combine arbitrary lines, rewrite URLs, remove MIME boundaries or ignore added text. RFC 6376 §3.4 specifies the exact order and edge cases, including different treatment of an empty body.

Use a conforming implementation for exact tests. A hand-edited approximation that changes line endings before verification can create the failure it is supposed to investigate.

Apply a controlled example

Consider the synthetic body line Pay<SP><SP>now<SP><CRLF>, where the bracketed labels denote bytes rather than literal text. Relaxed body canonicalization produces Pay<SP>now<CRLF> for that line. Simple body processing retains the internal and trailing spaces. A whitespace-only change of this kind can therefore have different outcomes under the two body algorithms.

Now append a new sentence after the signed message. Relaxed processing does not discard that substantive addition. Assuming full-body coverage and no other change in the test, the canonicalized body differs and so does its expected body hash. A footer rule cannot be declared safe merely because the sender uses relaxed/relaxed.

The example explains expected normalization, not a captured incident or an executed test. In production, account for MIME encoding, signed headers and the signature's actual length treatment. Two messages can render identically while their signed bytes differ.

Locate the transformation before changing policy

Preserve the original raw message, then obtain authorised comparison samples before and after suspected modifiers. Use copies for analysis. Compare an otherwise equivalent test with and without the suspected footer, link rewrite or re-encoding feature, keeping the transport route the same.

If the supported architecture allows it, perform required content changes before the appropriate final signing stage. If an intermediary re-signs, evaluate its new identity and alignment. Do not disable protective gateway processing or weaken domain policy solely to make one diagnostic test green.

As RFC 6376 §8.2 warns, a body-length l= limit changes how much canonicalized body is covered. It is not a general workaround for post-signing modification and can leave appended content outside the signed portion. Review the security implications and provider support rather than adding it to suppress a failure.

Prove the fix at the byte and route levels

Retain the original failure, canonicalization settings, controlled comparison and a received result from the corrected route. If changing canonicalization is the chosen supported remedy, confirm that the actual modifying operation falls within its permitted transformations. A new relaxed signature can tolerate some whitespace changes while remaining vulnerable to the original substantive rewrite. Close the issue only when the observed change and verification outcome agree.

Check the empty-body edge case

Under RFC 6376 §3.4.3, a completely empty or missing body becomes one CRLF, or two octets, in simple body canonicalization. Under RFC 6376 §3.4.4, relaxed body canonicalization produces zero octets for an empty body. A tool that hashes CRLF in both cases will disagree with the standard even though both messages appear blank. This is a specification example, not a complete DKIM verification or an executed mail test.

DKIM public-key syntax: identify truncated or malformed DNS values · Multiple DKIM signatures: find the aligned passing signature.

[ Takeaway ]

Read header/body algorithms separately; absent c defaults to simple/simple. Relaxed rules normalize specified whitespace, not substantive message edits. Empty-body handling differs: simple hashes CRLF; relaxed hashes zero octets.

[ By role ]

What this means for you

Choose your role for practical next steps.

IT / Mail Admin

Compare bytes under the actual algorithm.

Rendered text is insufficient for explaining body-hash failures.

Next steps

  1. Preserve original messages.
  2. Record c, h and l before testing.
  3. Repeat the affected gateway transformation.

CISO / SecOps

Avoid weakening coverage to hide a defect.

A body-length exception changes what the signature protects.

Next steps

  1. Review re-signing identities.
  2. Approve any coverage exception explicitly.
  3. Avoid disabling protective processing without review.

Founder / Non-technical

Fix the processing order.

A business disclaimer can be legitimate and still break a signature when inserted at the wrong stage.

Next steps

  1. Assign gateway and sender owners.
  2. Test the customer-facing route.
  3. Approve responsibility for the signing boundary.

[ FAQs ]

Frequently asked questions

What does c=relaxed/simple mean?

The header uses relaxed canonicalization and the body uses simple canonicalization.

RFC 6376 §3.5

What is the default when c is absent?

RFC 6376 defines simple/simple as the default.

RFC 6376 §3.5

Does relaxed lower-case Subject text?

No. Relaxed header processing lowercases field names, not field values.

RFC 6376 §3.4.2

Will relaxed body processing ignore a disclaimer?

No. An added substantive footer is outside ordinary whitespace normalization and changes a fully covered body.

RFC 6376 §3.4.4

Can visually identical messages have different hashes?

Yes. Rendering can hide byte, encoding, line-ending and MIME differences relevant to DKIM.

RFC 6376 §3.7

Is simple body processing completely byte-for-byte?

It still applies its defined handling of trailing empty lines and the final CRLF. Other body content is preserved.

RFC 6376 §3.4.3

Should I use l to tolerate appended content?

Do not use it as a generic repair. It changes coverage and requires a specific supported design and security review.

RFC 6376 §8.2

What evidence locates a damaging transformation?

Preserved raw samples around the suspected hop, the exact signature settings and a controlled repeat through the same route.

[ Sources ]

Sources

  1. RFC 6376

    Sections §1 · §3.4 · §3.4.1 · §3.4.2 · §3.4.3 · §3.4.4 · §3.5 · §3.7 · §6.1.3 · §8.2

[ Glossary ]

Glossary

DKIM
A domain-associated signature over selected message headers and body content verified with public-key data.

RFC 6376 §1

Canonicalization
Defined preparation of headers or body before DKIM hashing and verification.

RFC 6376 §3.4

Body hash
The encoded hash of the canonicalized body, with applicable length treatment, carried in bh.

RFC 6376 §3.5

Selector
The s value used with the signing domain to locate public verification data.

RFC 6376 §3.5

Enterprise provenance

Why top financial institutions and governments retired their email security dashboards.

Traditional email authentication platforms sell you a dashboard and ask your engineers to do the labour. In high-stakes environments, manual oversight means delayed enforcement, configuration drift and unmonitored shadow domains.

EmailAuth is the agentic email provenance platform. Our agents enforce p=reject, keep third-party senders aligned and move your domains to full RFC 9989 compliance, the new DMARC standard,, with human-in-the-loop auditability.

Governments Large enterprises Tier-1 financial institutions

SaaS · Dedicated tenancy · Air-gapped on-prem · BYOK encryption

Knowledge Base