DKIM|External Vendors

If a vendor signs mail on your behalf but doesn’t control your zone, you don’t have to hand them your DKIM private key to keep signing working: lets you delegate just the public key, while you keep the reference (and the ability to redirect it) yourself.

Why it matters

A DKIM signing gateway needs its public key published under your domain’s zone, at the the gateway signs with. If the gateway operator doesn’t have direct access to your , you’d otherwise need to manually copy their public key into your own zone every time they rotate it. A reference avoids that: it points your at a record the gateway operator controls directly, so they can rotate keys on their own schedule without ever needing access to your .

How it works

Set up a record for your DKIM that points at a hostname the gateway operator controls in their own zone. The gateway operator then publishes the actual DKIM public key (as a ) at that hostname. Because your ‘s just points there, any rotation the gateway performs takes effect automatically, with no further changes needed on your end.

Good to know

This is the same -delegation pattern covered briefly in DKIM | Guidelines; this article walks through the full worked example.

Worked example

Say Sample Corp (sample.com) hires an email gateway service, Example Net (example.net), to send and sign its newsletters with DKIM. DKIM works by publishing a small piece of verification data in (the internet’s address book) so that mailbox providers like Gmail can check a message’s signature is genuine.

Rather than Sample Corp manually copying that verification data into its own every time Example Net updates it, Sample Corp instead sets up a forwarding entry (a ) that always points to wherever Example Net currently publishes its data. That way, whenever Example Net changes its keys, Sample Corp’s follows along automatically, with no extra work on Sample Corp’s side. Sample Corp keeps ownership of that forwarding entry and can redirect it elsewhere at any time, while the day-to-day key management stays Example Net’s responsibility.

In practice, two such forwarding entries are usually set up side by side, so Example Net can switch smoothly from an old key to a new one without any downtime.

For reference, here is what the actual records look like:

  • On sample.com‘s : <vendor>-selector1._domainkey.sample.com () → sample-com-selector1.dkim.example.net
  • On sample.com‘s : <vendor>-selector2._domainkey.sample.com () → sample-com-selector2.dkim.example.net
  • On example.net‘s : sample-com-selector1.dkim.example.net (TXT) → v=DKIM1; k=rsa; p=<...>; n=<keysize>,<publication date>
  • On example.net‘s : sample-com-selector2.dkim.example.net (TXT) → v=DKIM1; k=rsa; p=<...>; n=<keysize>,<publication date>

With this in place, the gateway operator owns DKIM key management end to end, including rotation, without ever needing further changes on the customer’s side.

References & further reading

  • 6376 – DomainKeys Identified Mail (DKIM) Signatures: rfc-editor.org/rfc/rfc6376, updated by 8301 and 8463.
  • M3AAWG DKIM Key Rotation Best Common Practices, and M3AAWG’s best practices for implementing DKIM to avoid key-length vulnerabilities.