P H O T O N

CONSOLE

Loading

Cryptographic Authentication Guide

How to Generate 2048-Bit DKIM Keys for SMTP
OpenSSL Commands & 255-Byte DNS String Splitting

Generate production-grade 2048-bit RSA keys, format segmented DNS TXT records per RFC 1035, and verify digital signatures against Google and Yahoo deliverability standards.

5 min read • RSA 2048-Bit • RFC 6376 / RFC 1035
Direct Answer: Generating 2048-Bit DKIM Keys

To generate a 2048-bit DKIM key, use OpenSSL (openssl genrsa -out dkim.private 2048), extract the public key with openssl rsa -in dkim.private -pubout -out dkim.public, and publish the base64 string as a DNS TXT record at [selector]._domainkey.yourdomain.com. Because 2048-bit public keys exceed the 255-character DNS string limit, split the key into two quoted strings per RFC 1035.

1. Why 1024-Bit DKIM Keys Are Obsolete

Historically, email providers used 1024-bit RSA keys for DKIM (RFC 6376) signatures. However, cloud computing advancements allow 1024-bit keys to be factored in hours using rented GPU clusters.

Google, Yahoo, and Microsoft now mandate or strongly recommend 2048-bit RSA keys. Senders continuing to use 1024-bit keys face increased spam filtering and lower domain trust scores.

2. Step-by-Step OpenSSL Generation Commands

Run these commands in your server terminal:

# Step 1: Generate 2048-bit private key
openssl genrsa -out dkim_private.key 2048

# Step 2: Extract public key in standard PEM format
openssl rsa -in dkim_private.key -pubout -out dkim_public.pem

# Step 3: View public key contents (strip header & footer)
grep -v '^-' dkim_public.pem | tr -d '\n'

3. Handling the 255-Character DNS String Limit

Under RFC 1035, a single text string within a DNS TXT record cannot exceed 255 bytes. A 2048-bit base64-encoded public key contains approximately 392 characters.

To prevent DNS provider syntax rejections, the TXT record must be segmented into two adjacent quoted strings:

# Segmented 2048-Bit DKIM TXT Record Format
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0G..."
"...79sDkH88FhskLkJhd87sfkjdsf987213kjhKJHD..."

4. Formatting for Cloudflare, Route 53, and BIND

DNS Provider Chunking Behavior Recommended Input Method
Cloudflare Automatic Chunking Paste the single uninterrupted string into the content box; Cloudflare splits it automatically.
AWS Route 53 Strict Quote Separation Enclose each 250-char chunk in quotes: "part1" "part2".
BIND 9 / Named Parentheses Syntax Wrap in parentheses across multiple lines: ( "part1" "part2" ).

5. Testing Cryptographic Verification

Verify that your public key resolves cleanly across public DNS resolvers:

dig +short TXT photon._domainkey.yourdomain.com

Automatic 2048-Bit DKIM Signing with PhotonRelay

Photon Console automatically generates and manages 2048-bit DKIM keys with zero manual OpenSSL scripting required.

6. Frequently Asked Questions

Under RFC 1035, an individual DNS TXT record string cannot exceed 255 characters. A 2048-bit RSA public key is ~392 characters long. To publish it, divide the string into two consecutive quoted chunks within the same TXT record, or use modern DNS managers like Cloudflare that chunk strings automatically.

Google and Yahoo strongly enforce 2048-bit RSA keys. 1024-bit keys are considered cryptographically weak and may result in lower deliverability weighting or authentication warnings in recipient inboxes.

Run 'opendkim-testkey -d yourdomain.com -s selector -vvv' on Linux. If the key is valid, OpenDKIM will report 'key OK'.