- Go 97.8%
- Makefile 2.2%
| cmd | ||
| keys | ||
| tests | ||
| .gitignore | ||
| dns.go | ||
| dns.json | ||
| dns.txt | ||
| go.mod | ||
| go.sum | ||
| ignore.go | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| structure.go | ||
dkim2tests
Test vectors for dkim2
Tests
For each test there are three files in the tests directory. The primary
one is a toml file containing all the details of the test. There are also
two copies of the message, one before signing (.orig) and one after (.signed).
There are also two files containing all the relevant DNS records for
the tests. dns.json contains the public keys, keyed by DKIM hostname
(selector + _domainkey + domain). dns.txt contains the same as
regular DNS zone file entries.
dns.json and dns.txt are redundant, as the public keys used are also
included in each toml test file. dns.go provides helpers to use that
dns info as a mock resolver.
chaos_test.go provides an example of how to run the tests in Go.
TOML Structure
There is one test in each toml file in the tests directory. The
structure of the toml is included as Go struct in structure.go.
Name: the short name of the test
Description: a longer description
Comments: an explanation of what the test is testing
Spec: the version of the DKIM2 spec the test is written against
Section: relevant sections of the DKIM2 spec
OriginalMessage: a multiline field containing the message before signing - if this is empty, use OriginalFile
OriginalFile: file containing the original message
SignedMessage: a multiline field containing the signed message - if this is empty use SignedFile
SignedFile: file containing the signed message
MailFrom: the 5321.From of the message
RcptTo: a list of 5321.To addresses the message was sent to
ExpectedState: the expected validation state, e.g. permerror or pass
ExpectedError: a human readable error message
CanonicalDkim2Headers: a multiline field containing the Message-Instance and Dkim2-Signature headers that were signed
ExpectedFlags: The flags in the top Dkim2-Signature header
PrivateKeys: a section containing the private keys used to sign the message
DNS: a section containing the public keys in DNS format corresponding to the private keys
Regenerating tests
To regenerate the private keys, run make keys.
To generate public keys and dns data from the private keys, run make dns.
To generate tests, run make tests. (This will give a diagnostic about a
mail from not being found in public keys which can be ignored.)