Lion Cipher Lab

Verify email authenticity with DKIM from scratch

Why it matters

Business email compromise and credential phishing hinge on one trick: making a message look like it came from someone it did not. SPF, DKIM, and DMARC are the machinery that is supposed to stop that, and every SOC analyst reads their verdicts in mail headers daily — dkim=pass, spf=fail, dmarc=none. But a verdict you cannot reason about is a verdict you will misread. Analysts who trust a green 'dkim=pass' without asking whether the signing domain aligns with the visible sender miss forgeries that others catch, because a valid DKIM signature from attacker-owned throwaway.tld says nothing about…

What you'll learn

Steps in this lab

  1. Why you implement this once, by hand
  2. SPF, DKIM, and DMARC in plain terms
  3. Become your own DNS: generate the signing keypair
  4. Write the message you will sign
  5. Implement canonicalization and the body hash
  6. Sign the message from scratch
  7. Verify the signature — a clean PASS
  8. Break it: body tampering vs header tampering
  9. The phishing lesson: valid DKIM, failed alignment
  10. Limits, replay, and how a real analyst reads this

Open the full interactive lab →