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;
s=s1024; d=yahoo.com.au;
h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type;
b=Nin4jVEsnqKpfH6nKyRwaSxJzzaH5tX0hDJeJgNCx9af7VbBiV7kwEGn4z44Dtg/rTLOa7j4BO9HC
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 yahoo.com.au, so combined with the s tag, we would query s1024._domainkey.yahoo.com.au

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 s1024._domainkey.yahoo.com.au:

s1024._domainkey.yahoo.com.au. 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, yahoo.com.au, 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;
s=s1024; d=rogers.com;
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) (this_is_not_an_actual_email_address@rogers.com@22.33.44.55)
by smtp108.rog.mail.re2.yahoo.com 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" <this_is_not_an_actual_email_address@rogers.com>
From: "Guy Incognito" <this_is_not_an_actual_email_address@rogers.com>
To: "Rusty Shackleford" <rusty.shackleford@example.com>
Subject: This is an example for DomainKeys
Date: Sat, 17 Feb 2007 18:47:53 -0500
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0003_01C752C4.219885E0"
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 rogers.com

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 rogers.com uses DomainKeys but they do not use SPF/SenderID (just like Yahoo).

Here is the DNS key for s1024._domainkey.rogers.com:

s1024._domainkey.rogers.com. 3600 IN TXT "k=rsa\; t=y\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23
bzeoULYv4PeleB3gfmJiDJOKU3Ns5L4KJAUUHjFwDebt0NP+sBK0VKeTATL2Yr/S3bT/xhy+1xtj4RkdV7fVxTn56Lb4udUnwuxK
4V5b5PdOKj/+XcwIDAQAB\;"

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.