Sender authentication part 29: Some DomainKeys examples

Let's plow through a few real life examples.  Here's an actual DomainKey Signature:

Example 1

DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
ogY7pmNiJO1Piz5ViRxi5/UyCTfGNT9SmzBAN4M/aplVh/MOaPXxPf/2M2E1iRv8EZJV/YTlN4lHZ9Qj9AkndutoQyeZIY= ;

a = the signing algorithm is rsa-sha1

q = the method of querying the public key is through DNS

s = s1024 is prepended onto the domain for DNS querying

d = the sending domain is, so combined with the s tag, we would query

c = the canonicalization algorithm is nofws (right now, this means nothing to us but it will in another post)

h = the headers that were also signed in addition to the message content was the Message-ID, X-YMail-OSG header, a Received header, the X-Mailer header, Date header, From:, To:, MIME-Version: and Content-Type headers.

b = the digital signature created by the above headers and message content is that big, long string. The key would be combined over the two lines above, I have broken them up to fit them on the screen.

We look up the key by querying the TXT record for 7200 IN TXT "k=rsa\; t=y\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2
FAZVGE3kL23bzeoULYv4PeleB3gfm" "JiDJOKU3Ns5L4KJAUUHjFwDebt0NP+sBK0VKeTATL2Yr/S3bT/xhy+
1xtj4RkdV7fVxTn56Lb4udUnwuxK4V5b5PdOKj/+XcwIDAQAB\; n=A 1024 bit key\;"

Going back from our previous post, here is how to interpret this record:

k = the key type is rsa

t = the key is in testing mode

p = the public key is that big long string

n = Yahoo is using a 1024 bit key

What happened was the sending domain,, signed the message with the private key in the 1024 domain selector.  To verify this message, we get all the headers mentioned in the h-tag as well as all of the message content.  The hash is then computed on the canonical message (using the rsa-sh1 algorithm), the signature is then decrypted and then the two resulting hash values are compared.  If they are the same, the signature is verified. 


Example 2

Here's another example that includes more headers, it's an actual example but the identifying information is removed.

DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
h=Received:X-YMail-OSG:Message-ID:Reply-To:From:To:Subject:Date:MIME-Version:Content-Type:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE; b=KtFFU4wxXPcUJK898nIFK0IQRcYcCBIm3njPXKRDd4Mz2tFpVVxsheTpEljplbPZ0f1bnwPsi7+Xh5R/SalKW
zMALATeYvdfb/GwXvrLRLj5gIQmRVkFvcjh0VzZKX5+zxGk61G2VTn5mP38diu+PfNFJQHaNQBdZPrrWP1PeoA= ;
Received: from unknown (HELO guy) (
by with SMTP; 17 Feb 2007 23:47:53 -0000
X-YMail-OSG: vAZZ9C0VM1mTjD2RIy0jv0pZAt4gfY3d5924aL1_Ky0Levy4zRtEqhcJOYwI_MY2LQ--
Message-ID: <12345678$12345678$6700a8c0@guy>
Reply-To: "Guy Incognito" <>
From: "Guy Incognito" <>
To: "Rusty Shackleford" <>
Subject: This is an example for DomainKeys
Date: Sat, 17 Feb 2007 18:47:53 -0500
MIME-Version: 1.0
Content-Type: multipart/mixed;
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

Let's go through this one more time.

a = the algorithm is rsa-sha1

q = the key is to be queried by DNS

c = the canonicalization algorithm is nofws

s = prepend s1024 to the key to look it up in DNS

d = the signing domain is

h = the headers signed are a Received header, X-YMail-OSG, Message-ID, Reply-To, From, To, Subject, Date, MIME-Version, Content-Type, X-Priority, X-MSMail-Priority, X-Mailer, X-MimeOLE

b = the key is the two line string following the rest

Pay special attention to the headers in the message, each of the headers following the DomainKey Signature header are represented in the values in the in the h-tag.  Also note that in this case, the Reply-To is the envelope sender which happens to be the same as the sender in the From address.  Of interest is that uses DomainKeys but they do not use SPF/SenderID (just like Yahoo).

Here is the DNS key for 3600 IN TXT "k=rsa\; t=y\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23

k = the algorithm is rsa

t = the key is in testing mosde

p = the public key is that long string, minus the end-quotes

To verify we follow the procedure as in example 1.