What Is DKIM? Domain Keys Identified Mail Explained

Share Article

While email lets us connect with others online, it also gives sneaky people a way to trick users, as they try to make their messages look real by copying details from actual companies.

But there’s now a clever technique to uncover fake emails and prove who messages truly come from. It’s called DKIM, which is short for DomainKeys Identified Mail. Like fingerprints help the police know who touched something, DKIM works like a secret signature inside each email.

In this article, we’ll see how the secret signatures are put in and how DKIM works its magic to unmask impersonators.

black laptop public key cryptography DKIM concept

What is DKIM?

Have you ever wondered how your email program knows whether an email really came from the sender it says? DKIM is a sneaky way for email senders to prove they are who they claim to be. It stands for Domain Keys Identified Mail, which is a digital signature authentication method used widely on the internet.

Emails can sometimes be impersonated by mean-spirited people trying to trick others through email spoofing or phishing attacks. This is a big problem because sensitive information might get stolen. DKIM was created to fight against email spoofing and help authenticate legitimate emails using public-key cryptography.

Every website that sends emails has its private key, which is like a secret code only they know. When an email is sent, the website uses its private key to put a secret signature on the email message. This digital signature includes who the sender is, the topic, and when it was sent.

At the same time, the website also puts its public key out where email programs can find it, like posting a fingerprint online. Now, when you get an email, your email program can use the public key to check the secret signature inside and make sure it matches the sender.

If the signature is valid, your program knows for sure the email is really from whom it says.

How DKIM Works

DKIM uses some tricky techniques to put secret signatures on emails while also letting other computers verify them. When a website like example.com wants to send you an email, here are the steps their mail server takes to sign it using DKIM digitally:

Creating a Signature

The mail server first uses its private key to generate a digital signature for the outgoing message. This involves taking a cryptographic hash of the email’s header fields and body. This signature is like a special seal that shows the email is authentic and hasn’t been messed with.

Using Keys

Think of DKIM as a lock and key system. The sender uses a public key (known to everyone) and a private key (kept secret). They use the private key to create the signature, and the receiver uses the public key to check if it is valid.

Hash Algorithms

Common algorithms like RSA-SHA256 are used to convert the message into a unique numeric signature or hash value in a way that can’t be reversed. Researchers have found that RSA-SHA256 provides strong security.

Sending

The signed email is transmitted from example.com’s mail servers out to recipients on the internet in the usual way.

Verifying the Signature

When the email reaches the receiver, their email service uses the sender’s published public key (kept in the domain’s DNS records) to check the signature. If the keys match up, the email is verified. It’s a bit like matching puzzle pieces. If they fit perfectly, the email is good to go.

Components of DKIM

Selector Tags

A selector is a unique string added to the domain name to point email software to the right DKIM key information. For example, if example.com uses the selector “mail._domainkey,” the full Domain Name would be “mail._domainkey.example.com” in DNS records.

Different mail servers on a domain may use distinct selectors to access their designated keys. For example, a transactional server might use “mail-txn._domainkey,” while a marketing server uses “mail-mktg._domainkey.”

This allows signature policies to be customized per sending IP or mail flow. The proper use of selectors helps ensure signature validation and the authenticity of each email-originating component within a domain.

Private Key

When setting up DKIM, a domain like example.com first generates a unique private-public key pair. The domain owners then closely guarded the private key, while the corresponding public key can be shared freely.

Any time example.com’s mail server sends an email, the private key is used to encrypt important parts of the message, like the headers, body text, and timestamps, into a secret signature code. It’s like using the private key to sign the envelope in which the message is sent.

Only example.com’s private key can encode this signature. So, later, when the receivers get the email, they know it must have truly originated from the example.com domain. 

Public Key

As we learned before, the domain keeps the private key secret, but how do email servers verify the DKIM signature? That’s where the public key comes in. The public key shares some mathematical properties with its paired private key but cannot be used to encode signatures itself.

When example.com initially sets up DKIM, it generates their private-public key pair. Their mail servers keep the private key confidential while the corresponding public key is published openly. Typically, this public key is stored in DNS TXT records that can be looked up under example.com’s domain name. 

Now, when a recipient’s email service provider receives a message signed by example.com’s private key, it knows to find example.com’s public key through a DNS query. 

DKIM-Signature Header Fields

When an email is sent using DKIM, the sending mail server needs to generate a digital signature for authentication. But it can’t sign the entire message – that would be too large. Instead, it only signs certain vital parts of the email called header fields.

Header fields live at the top of every email and contain important details about the message, like who it’s from, what the subject is, when it was sent, and more. Common header fields included in the DKIM signature are “From,” “Subject,” “Date,” and “To.”

This helps identify the core elements of the message. During the signing process, the mail server combines the values from these header fields with the body text into one long string.

Hash Value

A hash value is a unique numeric code that represents the email content. The server runs the string through a cryptographic hash algorithm like RSA-SHA256 to generate the hash value. These algorithms transform the string into a single random-looking number in a way that can’t be reversed back to the original text.

Even a small change to the email causes the hash value to change completely. So, it acts like a fingerprint or DNA code uniquely identifying that exact message content. The hash value is then included as part of the digital signature encoded with the private key.

Later, when the receiving server validates the signature, it rebuilds the email string and re-runs the same hash algorithm. If the new hash value matches the one encoded in the signature, it proves no one altered the message contents.

DNS Records

Email servers need access to the domain’s public keys during verification for the digital signature process to work. But how do they find these keys online? This is done through the DNS. DNS stands for Domain Name System.

It’s the phone book of the internet that turns domain names like example.com into IP addresses. DNS also stores other helpful information through DNS records. DKIM uses a special type of DNS record called a TXT record. When a domain sets up DKIM signing, its public key and details are published in TXT records that live within their DNS entry.

For example, example.com may save its key under the record name “mail._domainkey.example.com.” Now, whenever someone tries to verify a DKIM signature, for example.com, their email server does a DNS lookup for that exact TXT record.

Benefits of DKIM

Reduces Email Spoofing and Phishing

Mean-spirited scammers send sneaky emails hoping to steal passwords or trick people with lies. But implementing DKIM can help stop these tricky spoofers in their tracks. With DKIM, each domain secretly signs emails in a special way only they can.

Later, when the email is received, servers can verify the actual sender using math magic with public keys. If a phishing email pretends to be from the bank but isn’t properly signed with their secret DKIM details, receivers will know it’s fake immediately because the hackers can’t perfectly copy the signature to disguise it as the real sender.

As more places adopt secure signing standards, scammers will have a much harder time deceiving people.

Validates Sender Authenticity

Before DKIM, there was no foolproof way for internet mail servers to confirm the true sender of messages. But through the secret signature process using private-public keys, DKIM establishes a digital fingerprint that reliably identifies the authentic source domain of any email.

When your email provider, like Gmail, receives a message, it looks for this hidden fingerprint as proof the sender is legitimate. Email servers can now definitively say, “Yes, this message came directly from example.com, not an imposter.”

They won’t mistake an impersonator for the real deal anymore, thanks to DKIM’s sneakily encoded signatures. Users no longer have to second-guess the true senders of important business or account messages since their identities are mathematically verified.

Increases Trust and Credibility

With all the tricky scammers online, it’s smart to be cautious and be a bit unsure if an email was really from who it claimed. However, DKIM uses its coding secrets to help solve this trust problem. When important groups like banks and stores use secure DKIM signatures, it earns them higher credibility in the eyes of email users.

Messages that are sent knowingly are authenticated as truly originating from trusted domains. DKIM also builds confidence in the entire communication system. Email providers that properly verify senders through signature checking gain customers’ assurance that their networks aren’t being misused.

Users, therefore, feel safer interacting with important accounts by email.

Enhances Email Deliverability

Email deliverability can be tricky, but DKIM uses its clever coding to help more messages arrive safely. Email servers run by big companies like Gmail, Outlook, and Yahoo work hard to keep spam and spoofing away.

But they need proof that the senders are legitimate before allowing the messages to inboxes. DKIM’s digital authentication seals give that important validation signal that emails should be delivered. Domains using DKIM signatures see a significant improvement in delivering to major email providers versus unsigned mail.

These secure coding stamps of approval help to identify messages from trusted sources that deserve delivery.

Lowers Spam Filtering Risks 

One big problem with emails is getting labeled as spam by mistake. Sometimes, genuine emails end up in the spam folder, like the mail carrier putting a letter in the wrong mailbox. But emails with this unique DKIM code are less likely to be marked as spam. 

Emails with DKIM are better recognized as authentic and trustworthy by email filters. And even if filters flag any messages, signature checks help speed up the process of clearing falsely stopped emails. Messages without DKIM signatures may trigger extra spam risk warnings since their identities can’t be verified as safe.

But, domains using DKIM get a major reliability boost since these filters recognize the cryptographic fingerprints that prove that the senders are authorized.

at sign with number lock email encryption concept

Supports Email Encryption

Even with DKIM signatures, email messages in plain text travel across the public internet, where snoopers might see private details. But encryption allows for the encoding of emails, using secret codes to solve that problem.

Techniques like S/MIME and PGP let senders scramble the contents that can only be readable by the intended recipient. But they need secure methods confirming the message origins first. That’s where DKIM comes in; it puts hidden fingerprints on emails to prove who sent it.

Then, encryption can use the right key to unlock the code so only the correct recipient can read the private message.

DKIM vs. Other Email Authentication Methods

Email authentication is necessary because we send private messages through email every day. From homework reminders to chatting with friends, we need to trust the emails we get really come from trusted contacts.

DKIM puts special secret codes into messages, but there are other techniques that take different coding approaches. Although DKIM is one clever coding method, let’s look at how it compares to alternatives.

DKIM vs. SPF (Sender Policy Framework)

DKIM and SPF are two guardians that help keep emails safe, but they guard in different ways. Unlike DKIM, which includes a code that travels with the email and proves it’s from the person or company it claims to be from, SPF works by domains publishing a list of authorized mail servers in DNS.

When mail arrives, receivers check if it came from an approved location on that list. This IP matching can help block some spoofing, but it isn’t foolproof. Some hackers could still pretend to be internal addresses on the SPF.

It is also quick to set up, but SPF only verifies at the server level, so impersonation tricks can still slip through. So, for a more protected approach, it is advised that you use both methods together. Their unique but complementary techniques make it incredibly difficult for impersonators to dodge authentication unnoticed.

DKIM vs. DMARC (Domain-based Message Authentication, Reporting, and Conformance)

DKIM only checks individual messages, not what happens after. And this is where DMARC comes in. DMARC is like a mail supervisor. It has domains publish online on what to do with emails that fail DKIM and SPF checks.

Should they be rejected or sent to spam? When any mail arrives, DMARC watches DKIM and SPF verifying. If any fingerprints don’t match, DMARC will take action, like blocking the email. This extra supervision helps filter out more fake messages.

So, while DKIM focuses on coding each email, DMARC uses the domain’s instructions to oversee the whole delivery process. Their combined techniques make it incredibly hard for fake emails to get through. 

Conclusion

Authentication is key to keeping conversations genuine when sending and receiving emails. DKIM is a cool tool that helps ensure the emails you send and receive are authentic.

Because from the start, DKIM aims to outsmart spoofing through unique fingerprints that unlock the true identities of messages. Now, dominant domains worldwide use DKIM to shield their exchanges from impersonators and hackers.

You might also like