[ Enterprise operations ]

Changing an outbound gateway without breaking signed messages

Place authorized DKIM signing after relevant gateway transformations, then verify the actual bytes and trusted receiver results.

By the EmailAuth research team · 3 min read

[ Key points ]

  • Place authorized DKIM signing after relevant gateway transformations, then verify the actual bytes and trusted receiver results.
  • Final signing protects transformed content; it does not repair an earlier broken signature.
On this page

Changing an outbound gateway can alter a signed message even when its visible purpose is simply routing mail. Footers, link rewriting, MIME conversion and header edits may invalidate an existing DKIM signature. Locate the exact modification and signing boundaries before changing DNS or blaming the receiving provider.

Draw the message-processing order

Document the application output, first signer, gateway transformations, final signer and receiver. Capture an authorized raw message immediately before and after the gateway where possible. Preserve CRLF line endings and exact bytes; copying a displayed message into a text editor can create changes that never occurred in transit.

DKIM signs selected headers and a canonicalized body. Inspect the signature's d, s, h, c and any body-length restriction. Relaxed canonicalization tolerates specific formatting differences, not arbitrary content changes. A footer added after full-body signing normally changes the body hash. RFC 6376, sections 3.4, 5 and 6.

Compare the signing boundaries on paper

Assume From alerts@example.test, a valid original signature with d=example.test and selector first, relaxed body canonicalization, and no l= body-length limit. No real key or signed message is supplied.

  • Before gateway transformation: signature validity is a premise, not an observed cryptographic result.
  • After appending a nonempty text footer that changes the canonicalized full body: the original body hash no longer matches, so that original signature would fail under the stated assumptions.
  • After final authorized signing of the transformed bytes with d=example.test and selector final: a correctly generated and independently verified new signature could provide an aligned DKIM path. Actual new-signature validity remains untested. The old signature is not repaired; keeping or removing it is a separate processing choice.

No key generation, signing, verification or gateway execution occurred for this written comparison. In production capture the actual before/after bytes and key data, then measure rather than assume each outcome.

Interpret the result narrowly

An observed failed old signature after a footer would establish that this transformation breaks that signature. It does not establish that every gateway modification breaks every signature. An unsigned header can change without affecting the signed header set. Canonicalization can also preserve validity across some whitespace changes. Test the actual gateway features, MIME structures and signature settings instead of extrapolating from a single text message.

The written example assumes the same signing and From domain, but does not execute full DMARC discovery or a receiving provider's policy. DMARC requires a passing aligned authentication path, and an unrelated gateway signing domain does not automatically supply that alignment. RFC 9989. A new valid signature must still be evaluated in relation to the intended author identity.

Choose the production signing boundary

Where supported, place final authorized signing after legitimate transformations that would otherwise alter signed content. Configure the new signer with a valid domain and selector under the organization's approved authority. Publish and verify its public key before directing production traffic through it. Preserve necessary old selectors for queued or delayed messages under a deliberate retirement plan.

Do not solve the footer problem by promising that relaxed canonicalization accepts any rewrite. Do not reduce signed-body coverage as a routine workaround; that changes what the signature protects. If an upstream signature must survive, adjust transformations or routing and verify the exact bytes rather than assuming final re-signing repairs the earlier signature.

Validate the gateway cutover

Test plain text, HTML, attachments and representative business templates through the actual authorized route. Compare raw headers, authentication results from a trusted receiver and message rendering. Include bounce handling and queue behavior. A local signature pass establishes cryptographic validity under supplied key data, not inbox placement, user trust or delivery of every template.

Rollback criteria should identify which legitimate flows or authentication paths failed and how to restore the old processing order. Retain the evidence before changing settings again. Close only after both the new route and the planned recovery path are understood.

[ Takeaway ]

Final signing protects transformed content; it does not repair an earlier broken signature.

[ By role ]

What this means for you

Choose your role for practical next steps.

IT / Mail Admin

Locate the final signer

Validate bytes across each processing boundary.

Next steps

  1. Capture raw samples.
  2. Test transformations.
  3. Verify aligned final signatures.

CISO / SecOps

Preserve signature meaning

Do not weaken coverage to hide a modification problem.

Next steps

  1. Review signing authority.
  2. Protect private keys.
  3. Separate validity from trust.

Founder / Non-technical

Protect business templates

A gateway cutover can change important customer messages.

Next steps

  1. Identify critical templates.
  2. Approve a test window.
  3. Agree rollback signals.

[ FAQs ]

Frequently asked questions

Can a footer break DKIM?

Yes, if the footer changes canonicalized bytes covered by the signature; the written example assumes full-body coverage and such a change.

Does relaxed canonicalization protect arbitrary rewrites?

No. It normalizes defined formatting differences only.

Does final re-signing restore the old signature?

No. It creates a separate signature over the transformed message.

Is a gateway signature always aligned?

No. Compare its signing domain with the author domain under the applicable DMARC alignment mode.

Are raw message artifacts supplied?

No. The example is a written boundary comparison, not a generated message bundle.

Was a test key generated or saved?

No. No key generation, signing or cryptographic verification was executed for this comparison.

Does a local DKIM pass prove inbox placement?

No. Receiver filtering and delivery behavior are separate.

Which production messages need testing?

Representative text, HTML, attachment and critical application templates across the real gateway features.

[ Sources ]

Sources

  1. RFC 6376 DKIM

    Sections §3.4 · §3.5 · §3.6 · §3.7 · §6.1 · §6.3

  2. RFC 9989 DMARC

    Sections §4.4 · §5.3.5 · §5.4 · §7.4 · §8

[ Glossary ]

Glossary

Canonicalization
The specified normalization applied before computing DKIM hashes.
Selector
The DKIM signature value used with the signing domain to locate a public key.

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