Skip to content

DKIM Syntax

The syntax of DKIM is defined by RFC 6376, which specifies the format and rules for the DKIM-Signature header field, the public key DNS record, and the signing and verification algorithms.

The DKIM-Signature header field consists of a series of tag-value pairs, separated by semicolons, that provide information about the DKIM signature. The tags are case-insensitive and have the following meanings:

TagDescription
vThe version of DKIM. The current version is 1.
aThe algorithm used to generate the hash and the signature. The supported algorithms are rsa-sha1 and rsa-sha256.
bThe signature data, encoded in base64.
bhThe hash of the email content, encoded in base64.
cThe canonicalization algorithm used to normalize the email headers and body before hashing. The supported algorithms are simple and relaxed.
dThe domain of the signing entity.
hThe list of header fields that are included in the signature, separated by colons.
iThe identity of the signing agent, which can be a subdomain or a user within the signing domain.
lThe length of the email body that is signed, in bytes. If omitted, the whole body is signed.
qThe query method used to retrieve the public key. The supported method is dns/txt, which means the public key is stored in a TXT record in the DNS.
sThe selector that identifies the public key to use for verification.
tThe timestamp of when the signature was created, in seconds since 00:00:00 on January 1, 1970 UTC.
xThe expiration time of the signature, in seconds since 00:00:00 on January 1, 1970 UTC. If omitted, the signature does not expire.
zThe original header fields that were signed, encoded in base64. This tag is optional and only used for debugging purposes.

An example of a public key DNS record is:

Selector:

dkimkey._domainkey.example.com.

Value:

"v=DKIM1; h=sha256; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCfjgu4wJ4hm7T3cjhYfyX3WfZwLGNqJtU2Ol1i8sT1o3F1FbZI4P7FqQW7MkMfsHnY6f7loG+RwkZsKdowq+8Gg9G2xRF1YJynBKLpdX4eR4Q2m5F3LjMfQSSMmN1CRrSeyRGNVQqjxweG5lJfR0GZsT7hnrccllH+oL1HhQIDAQ"