← Back to all products
$19
DKIM Validator
Generate and validate DKIM signatures, debug authentication failures, and scan domains.
MarkdownPythonCI/CD
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 10 files
dkim-validator/
├── LICENSE
├── README.md
├── examples/
│ └── sample_dkim_header.txt
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_dkim-tag-reference.md
│ └── 04_license.md
├── index.html
└── src/
└── dkim_validator.py
📖 Documentation Preview README excerpt
DKIM Validator
Generate and validate DKIM signatures and DNS records. Debug authentication failures and scan domains for existing DKIM configurations.
Features
- DNS record checking — Validates DKIM TXT records for any domain + selector
- Multi-selector scanning — Probes 15 common selectors (Google, Microsoft 365, Mandrill, etc.)
- DKIM header parsing — Extracts and explains all tags from DKIM-Signature headers
- DNS record template generation — Creates ready-to-paste TXT records for new domains
- Key size validation — Warns on weak keys (< 1024 bits)
- Tag descriptions — Human-readable explanations of every DKIM tag (v, a, b, bh, c, d, h, s, etc.)
- JSON output — Machine-readable results for CI/CD integration
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# Check DKIM for a domain with default selector
python src/dkim_validator.py check example.com
# Check with a specific selector
python src/dkim_validator.py check example.com --selector google
# Scan for all DKIM selectors on a domain
python src/dkim_validator.py scan example.com
# Generate a DKIM DNS record template
python src/dkim_validator.py generate --domain example.com --selector default
# Parse a DKIM-Signature header from an email
python src/dkim_validator.py parse-header --file examples/sample_dkim_header.txt
Common Selectors Scanned
The scan command checks these selectors automatically:
| Selector | Provider |
|---|---|
selector1, selector2 | Microsoft 365 |
google, google2048 | Google Workspace |
default, dkim, mail | Common custom |
s1, s2 | Generic |
k1, k2, k3 | Various ESPs |
mandrill, mxvault | ESP-specific |
DKIM Tag Reference
| Tag | Name | Example |
|---|---|---|
v | Version | v=1 (always 1) |
a | Algorithm | a=rsa-sha256 |
b | Signature | Base64-encoded signature data |
bh | Body hash | Base64-encoded body hash |
c | Canonicalization | c=relaxed/relaxed |
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/dkim_validator.py
#!/usr/bin/env python3
"""
DKIM Validator — Email Arsenal (DataNest)
Generates and validates DKIM signatures and DNS records. Debug DKIM
authentication failures and generate key pairs for new domains.
Usage:
python dkim_validator.py check example.com
python dkim_validator.py check example.com --selector google
python dkim_validator.py generate --domain example.com --selector default
python dkim_validator.py verify --header-file dkim_header.txt
Dependencies: Python 3.10+ stdlib only
License: MIT
"""
from __future__ import annotations
import argparse
import base64
import hashlib
import json
import logging
import re
import socket
import struct
import sys
from dataclasses import asdict, dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
logger = logging.getLogger("dkim_validator")
DNS_TYPE_TXT = 16
DNS_TIMEOUT = 5
# Common DKIM selectors used by major providers
COMMON_SELECTORS = [
"default", "selector1", "selector2", # Microsoft 365
"google", "google2048", # Google Workspace
"s1", "s2", # Generic
"dkim", "mail", # Common custom
"k1", "k2", "k3", # Various
"mandrill", "mxvault", # ESP-specific
# ... 457 more lines ...