Gaming industry under DDoS attack. Get DDoS protection now. Start onboarding
  1. Home
  2. Developers
  3. What Is a DKIM Record?

What Is a DKIM Record?

  • By Gcore
  • June 6, 2023
  • 3 min read
What Is a DKIM Record?

DomainKeys Identified Mail (DKIM) plays a crucial role in email authentication, combating email spoofing effectively. This fraudulent act, common in phishing and spamming activities, involves forging the sender’s address to appear as if it’s from someone else. In this comprehensive guide, we delve into the key aspect of DKIM—a DKIM record, exploring its function and significance.

What Is a DKIM DNS TXT Record?

A DKIM record is a specific type of TXT record integrated into your domain’s DNS settings. Embedded with a public cryptographic key, this digital fingerprint assists receiving email servers in decoding the DKIM signature of an incoming email. The email’s DKIM signature, initially encrypted with the sender’s private key, verifies the email’s authenticity and ensures it has remained unchanged during transmission, once successfully decoded.

How Does DKIM DNS TXT Record Function?

  1. Key Generation: As an email sender, you generate a unique pair of private and public keys. The private key is kept secure on your sending mail server, while the public key is included in the DKIM DNS record on your domain’s DNS.
  2. Email Sending: During email dispatch, your email server creates a unique DKIM signature for the message using your private key. This signature forms part of the email’s header (DKIM Header), which includes details such as the sender, recipient, and subject.
  3. Email Reception: Upon receipt, the recipient’s mail server refers to your DKIM DNS record, locates your public key, and attempts to decrypt the DKIM signature from the email’s header.
  4. Verification: If the recipient’s mail server can successfully decrypt the signature using the public key, and the decrypted contents match the email headers, the email’s authenticity is confirmed, and it is deemed to have remained unaltered in transit. If not, the email is flagged as potentially suspicious.

What Does a DKIM Record Look Like?

A DKIM record consists of various pieces of information encapsulated in special tags (letters preceding the “=” characters). The specific details of the DKIM record, including the public key and selector, depend on your unique mail server and configuration. A sample DKIM record may look like this:

v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmZ5Ch+0+ZKKJaAu1tPjq4wFtEn6JViEHtneZgCYzFIPzG6VqzRb+oUV9mH5aW7Y9JUyziShypsjG9cBZx94e2/e7xak2HcXwsg5Kj+eu9ZxJ4IQIDAQAB; t=s; n=core; s=email;

Where:

  • v=DKIM1; – This indicates the version of DKIM, which is DKIM1
  • k=rsa; – This specifies the key type, which in this case is RSA
  • p=MIGfMA0GCSqG…IDAQAB; – This is the public key used by receiving servers to decrypt the DKIM signature. Note that the actual key is much longer; it’s truncated here for readability
  • t=s; – This is the testing flag. In this case, it indicates that this domain is testing DKIM, and the receiving server should not consider a DKIM failure as a reason to reject the message
  • n=core; – This indicates notes of potential interest to administrators. Here, ‘core’ is used as an example
  • s=email; –  This is the selector, which can be thought of as an identifier for the key. When a server receives a message, it will look up the DKIM record using the domain and selector; in this case, ’email’ is the selector

The name of this DKIM TXT record in DNS will be something like email._domainkey.yourdomain.com, where email._domainkey is the name you choose (selector) and yourdomain.com is your domain.

The specific details for your DKIM record, such as the public key and selector, will depend on your specific mail server and configuration.

How to Set Up DKIM Records?

Setting up DKIM involves generating a public-private key pair and adding the DKIM record to your DNS. The specifics can vary somewhat depending on your domain registrar and email service, but the general steps are as follows:

1. Generate a DKIM Key. This process will generate a pair of keys: a private key, which stays on your mail server, and a public key, which will be published in your DNS records. Several online tools can help you generate a DKIM key pair, or your email service provider might provide a tool or instructions to do this.

2. Create a Selector.  A selector is a simple string used to help identify the DKIM public key in your DNS records. For example, if you choose “mailer” as your selector, you might name your DKIM record something like “mailer._domainkey”.

3. Add the DKIM Record to Your DNS. Once you have your public key and selector, you will create a new TXT record in your DNS settings. The exact process can vary depending on your DNS provider, but you will generally need to input your selector (e.g., mailer._domainkey) as the Host, and a value that includes your public key and some other DKIM settings. The value might look something like this:

v=DKIM1; k=rsa; p=YOUR_PUBLIC_KEY

Replace YOUR_PUBLIC_KEY with the public key that was generated in step #1.

4. Configure Your Email Server. You will need to configure your email server to sign outgoing messages using the private key that corresponds with the public key in your DNS records. This process can vary widely depending on your specific mail server software.

5. Test Your Setup. Finally, you will want to send test emails to verify that everything is working as expected. There are various online DKIM check tools that can help with this. These tools will tell you whether your emails include a valid DKIM signature.

Note: Any changes to your DNS records can take some time (sometimes up to 48 hours) to propagate throughout the internet. So, don’t worry if your new setup doesn’t work immediately.

Conclusion

Looking for reliable, high-performance DNS hosting? Choose Gcore DNS Hosting for fast and resilient DNS services:

  • Global latency averaging 30 ms
  • Anycast routing
  • Multiple load balancing options, including Geobalancing
  • Free-forever through enterprise-grade plans

Try for free

Related articles

What is DNS load balancing?

DNS load balancing is a technique that distributes incoming network traffic across multiple servers by manipulating DNS responses to improve the availability and performance of applications or services. It works at the application layer (la

What is GEO DNS?

GeoDNS is a DNS server technology that returns different IP addresses based on the geographic location of the client making the request. This enables geographic split-horizon DNS responses, directing users to servers closest to their physic

What is cloud networking: benefits, components, and implementation strategies

Cloud networking is the use and management of network resources, including hardware and software, hosted on public or private cloud infrastructures rather than on-premises equipment. Over 90% of enterprises are expected to adopt cloud netwo

3 use cases for geo-aware routing with Gcore DNS

If your audience is global but you’re serving everyone the same content from the same place, you're likely sacrificing performance and resilience. Gcore DNS (which includes a free-forever plan and enterprise-grade option) offers a straightf

Flexible DDoS mitigation with BGP Flowspec cover image

Flexible DDoS mitigation with BGP Flowspec

For customers who understand their own network traffic patterns, rigid DDoS protection can be more of a limitation than a safeguard. That’s why Gcore supports BGP Flowspec: a flexible, standards-based method for defining granular filters th

Tuning Gcore CDN rules for dynamic application data caching

Caching services like a CDN service can be a solid addition to your web stack. They lower response latency and improve user experience while also helping protect your origin servers through security features like access control lists (ACLs)

Subscribe to our newsletter

Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.