skip to content

What does each tag in the DKIM key record "v=DKIM1; k=rsa; h=sha256; s=email; t=y:s; p=MIIB..." tell a verifier, and which are defaults?

level: middleimportance: should knowfreq 24%

answer

  1. unknown tags are ignored
  2. version must lead
  3. hash list, not header list
  4. service type, not selector
  5. two flags: testing and subdomains

basics

~20 s

v=DKIM1 is the version, k=rsa the key type, h=sha256 the only hash this key accepts, s=email the service, t=y a domain still testing and t=s no subdomain i= values; p= is the key. Only p= is required.

solid answer

~40 s

`v=DKIM1` is the version: RECOMMENDED, and if present it must be first and exactly `DKIM1`. `k=rsa` is the key type and is also the default; the other defined value is `ed25519` (RFC 8463, September 2018). `h=sha256` lists the hash algorithms this key may be used with; when absent, all are allowed. `s=email` limits the key to mail, which the default `*` already covers. In `t=`, the flag `y` says the domain is testing DKIM, and RFC 6376 tells verifiers not to treat its mail differently from unsigned mail; the flag `s` says any `i=` in a signature must use exactly the `d=` domain, not a subdomain. `p=` is the base64 public key and the only REQUIRED tag. Here `k=` and `s=` restate defaults; `h=`, `t=y` and `t=s` change behaviour.

go deeper

for a junior

Recall that p= is the only required tag and holds the key, and that k= defaults to rsa with ed25519 as the other value.

for a middle

Explain every tag's default and meaning, and keep the key record's s=, h= and t= apart from the same letters in the DKIM-Signature header.

for a senior

Show the production checks: k= agreeing with the signer's algorithm, h= not excluding the hash in use, a forgotten t=y, and whether t=s fits how i= is used.

for a principal

Decide which tags a house standard requires on every record, such as t=s by default and no leftover testing flags, and how records are reviewed.

## The tag list and its two rules A **DKIM key record** is the TXT value published at `<selector>._domainkey.<signing domain>` (RFC 6376 section 3.6.1). It is a `tag=value` list separated by semicolons, and two rules govern the whole list: - **Unknown tags MUST be ignored.** A record carrying a tag a verifier does not understand is still usable, which is how RFC 8463 could add a key type without breaking anyone. - **`v=`, if present, MUST be the first tag and MUST read exactly `DKIM1`.** A record that begins with `v=` and any other value is discarded; the comparison is a string match, so `DKIM1.0` is not `DKIM1`. The record in the question, `v=DKIM1; k=rsa; h=sha256; s=email; t=y:s; p=MIIB...`, uses every tag a publisher normally sets. ## Each tag, its default and its meaning | Tag | In this record | Default when absent | What it tells a verifier | |---|---|---|---| | `v=` | `DKIM1` | `DKIM1` | Record version; must lead the list | | `k=` | `rsa` | `rsa` | Key type; `ed25519` is the other defined value | | `h=` | `sha256` | all algorithms | Hash algorithms this key may be used with | | `s=` | `email` | `*` | Service types the key applies to | | `t=` | `y:s` | no flags | Testing mode, and no subdomain `i=` values | | `n=` | absent | empty | Human notes; never interpreted | | `p=` | `MIIB...` | none, REQUIRED | Base64 public key; empty means revoked | Reading the record tag by tag: 1. `v=DKIM1` restates the default; it is still worth publishing because it makes the record self-identifying. 2. `k=rsa` restates the default. With `k=ed25519`, `p=` would hold a raw 32-byte Ed25519 key, 44 base64 characters long. 3. `h=sha256` narrows the default "all". RFC 8301 (January 2018) already forbids rsa-sha1 for signing and verifying, so listing only `sha256` mostly guards against old signers; a signature whose `a=` implies a hash not in the list cannot use this key. 4. `s=email` restricts the key to the mail service; `*`, the default, matches every service type, and `email` is currently the only other defined one. 5. `t=y:s` sets two independent flags, explained below. 6. `p=` carries the key. Its encoding is defined by `k=`. ## The t= flags in practice The `t=` tag holds a colon-separated list of flags; unrecognised flags are ignored. - **`y` (testing).** The domain is trying DKIM out. RFC 6376 says verifiers MUST NOT treat messages from a signer in testing mode differently from unsigned mail, even when the signature fails, and MAY track results to help the signer. It is a switch for a trial period; left on afterwards, it invites receivers to give the domain's signatures no weight. - **`s` (strict subdomain).** If a signature carries `i=` (the agent or user identifier), the domain on the right of its `@` must be exactly the `d=` domain, not a subdomain of it. Without the flag a key published for `example.com` may also back `[email protected]` (section 3.10). RFC 6376 RECOMMENDS `s` unless subdomaining is needed. ## Tags that look alike elsewhere Mail reuses short tag names, and confusing them is a classic interview slip: - **`s=`**: in the `DKIM-Signature` header it is the selector; on the key record it is the service type. - **`h=`**: in the signature it lists the signed header fields; on the key record it lists acceptable hash algorithms. - **`t=`**: in the signature it is the signing timestamp; on the key record it holds the `y` and `s` flags; in a DMARC policy record it is DMARC's own testing flag, a different mechanism with different effects. Any answer that names one of these must say which record it sits in. ## What the key record cannot do - It cannot limit a key to particular local parts. DomainKeys and RFC 4871 had a `g=` tag for that; RFC 6376 (September 2011) dropped it, verifiers must ignore it, and signers are advised not to publish it. - It cannot carry an expiry date; the expiry tag `x=` belongs to the signature. - It cannot say which servers may sign; anyone holding the private key can. ## Reviewing a record 1. Check that `v=DKIM1`, if present, is first. 2. Check that `k=` matches the algorithm the signer uses (`rsa-sha256` with `rsa`, `ed25519-sha256` with `ed25519`). 3. Check that `h=`, if present, includes the hash the signer uses. 4. Look for a leftover `t=y` from a past trial, and decide whether `t=s` fits how the domain uses `i=`. 5. Confirm that `p=` is complete and not empty.

  • Why is a forgotten t=y on a DKIM key record a problem?
    `t=y` is meant for a trial. RFC 6376 tells verifiers not to treat mail from a signer in testing mode differently from unsigned mail, even when the signature fails. Left on after the trial, it invites receivers to give signatures the domain relies on no weight. Remove it once test messages show `dkim=pass`, and include stray flags in record reviews.
  • Can the g= tag still limit a DKIM key to certain local parts?
    No. `g=` existed in DomainKeys and RFC 4871 key records; RFC 6376 (September 2011) dropped it, verifiers must now ignore it, and signers are advised not to include it. A domain that wants to fence an outside signer today gives it a dedicated subdomain as `d=`, and can add `t=s` so that `i=` values below `d=` are refused.

  • On the key record, s= is the selector name.
  • On the key record, h= lists the header fields that must be signed.
  • A DKIM key record without v=DKIM1 is invalid.
  • An unknown tag makes the whole key record unusable.
  • The key record's t=y is the same thing as DMARC's testing flag.