When it comes to maintaining the integrity of the contents of an email and verifying that they genuinely come from a trusted sender, DKIM is the authentication protocol that most security teams trust. This email authentication standard operates on cryptographic algorithms to generate a digital signature on each email.
In this way, the recipient can authenticate the sender and ensure that the message content has not been tampered with during transit. Once the recipient has this confirmation that the incoming email is indeed from a reliable source, they can rest assured that it does not bring along any phishing or spoofing threats.
In this article, we’ll look at what goes behind this authentication protocol, particularly focusing on DKIM’s two cryptographic algorithms. To start off, explore the two major algorithms used by DKIM — RS256 and RS512, which combine RSA encryption with SHA-256 and SHA-512 hashing functions, respectively. The job of both these algorithms is to protect the integrity and authenticity of email content, but they differ in key areas, such as security strength, processing requirements, and compatibility. Let’s delve deeper into this.

How does DKIM use cryptographic algorithms for email security?
When an email goes out from the sender’s end, DKIM creates a digital signature with the help of cryptographic algorithms, which in turn, generate a unique hash of certain parts of the email message, such as the ‘From’ and ‘Subject’ lines, and then encryptes it with its private key. The signature is then attached to the header of the message.
When the email reaches the receiver, its server decrypts the signature in the email to retrieve the original hash by using the public key of the sender from the DNS of the sender. It then compares this hash with one it generates itself from the email received. If the two hashes match, the email is considered genuine and not spoofed.
How are RS256 and RS512 different than each other?
RS256 and RS512 are two cryptographic algorithms used in DomainKeys Identified Mail (DKIM) for authenticating and ensuring the integrity of emails. The differences between them mainly lie in the hashing function used, which affects their strength in security, processing performance, and compatibility.
Let’s take a closer look at each of them:

RS256 (RSA with SHA-256)
Security
RS256 is a standard DKIM algorithm, most commonly used to secure email communication. It uses SHA-256 to generate a 256-bit hash that protects against hash collisions. This level of strength ensures that a hash value cannot be forged to produce a similar counterfeit message, thereby safeguarding its integrity.
Performance
Performance-wise, the RS256 is quite efficient even with RSA key sizes over 2048 bits. It works well because of its SHA-256 hashing function. This function has a relatively short hash at 256 bits, which enables very fast processing and verification of signatures. Since the hash length is relatively shorter, RS256 consumes less computing power than larger hash algorithms, making it suitable for high-volume environments where email throughput is critical.

Compatibility
With RS256, you don’t have to worry about compatibility issues, as it supports virtually all modern and legacy email systems. This means that it works effectively across a variety of different infrastructure configurations, making it a widely adopted algorithm.
RS512 (RSA with SHA-512)
Security
RS512 uses SHA-512, which creates a 512-bit hash. This offers much better in terms of security when compared to SHA-256. This makes the former highly resistant to brute force attacks as well as collision attacks. It is very useful for organizations that have very strict security requirements or deal with sensitive data.
Performance
Although it provides more security, the computational load is higher with RS512 than with RS256 because the hash size is bigger. It may lead to a slight delay in processing, and this might cause a difference in high-volume email operations. However, if your organization prioritizes security over speed, RS512 is the apt choice for you.

Compatibility
Given the higher computational load of this algorithm, RS512 may not be well supported by older email servers or systems that haven’t optimized for SHA-512. If you want the enhanced level of security that RS512 provides, it is important that you upgrade your infrastructure that is compatible with it.
What are the emerging trends in DKIM cryptographic algorithms?
Cyberattacks are getting more frequent and severe, which means that traditional techniques are no longer capable of keeping up with the growing threats. New trends in DKIM cryptographic algorithms that are pushing email security to new levels of resilience and efficiency.
Elliptic Curve Cryptography (ECC)
These days, ECC is being preferred over RSA-based cryptography as it offers sound security with much smaller key sizes. For instance, if you use a 256-bit elliptic curve, it would provide comparable security to a 3072-bit RSA key but take significantly less time for verification.

Automated key rotation
One of the best things you can do to protect your email infrastructure with DKIM is to rotate keys regularly. With DKIM’s automated key rotation, you don’t have to worry about doing it manually. This rotation feature regularly replaces the public and private keys without human intervention to further improve security by limiting each key’s lifespan and making it harder for attackers to crack the keys.
Quantum-resistant algorithms
You’d be surprised to know that quantum computing has the potential to break most traditional cryptographic algorithms, such as RSA and ECC. Even though it is an emerging technology, quantum computers theoretically break these systems much more easily than their classical counterparts. This is why we need something that is far more robust and resistant to quantum algorithms. Research into quantum-resistant algorithms is underway to future-proof DKIM from the threats of quantum computing and ensure continued email security in a quantum-enabled future.

To sum up
As you know, DKIM is one of the most crucial authentication protocols that ensures the integrity of emails. By using standards like RS256 and RS512, DKIM offers you the flexibility to choose the level of security you want for your email communications. But given the ever-evolving threat landscape, it is crucial that you keep upgrading your security strategies.
To get started with DKIM implementation, book a demo with us today!