[TLS] Query regarding generating client_write_key.
nilesh <nilesh.tayade@netscout.com> Tue, 27 September 2011 08:50 UTC
Return-Path: <Nilesh.Tayade@netscout.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 18A6E21F8C97 for <tls@ietfa.amsl.com>; Tue, 27 Sep 2011 01:50:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.599
X-Spam-Level:
X-Spam-Status: No, score=-6.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cwp0iJPws6nC for <tls@ietfa.amsl.com>; Tue, 27 Sep 2011 01:50:29 -0700 (PDT)
Received: from exprod6ob110.obsmtp.com (exprod6ob110.obsmtp.com [64.18.1.24]) by ietfa.amsl.com (Postfix) with SMTP id 2DECF21F8C81 for <tls@ietf.org>; Tue, 27 Sep 2011 01:50:29 -0700 (PDT)
Received: from nsmailfe2k3.netscout.com ([12.187.89.175]) (using TLSv1) by exprod6ob110.postini.com ([64.18.5.12]) with SMTP ID DSNKToGO8tHP7x2Ma3u3CGGpTyHy8JETFX8d@postini.com; Tue, 27 Sep 2011 01:53:13 PDT
Received: from nsmail.netscout.com ([192.168.39.90]) by nsmailfe2k3.netscout.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 27 Sep 2011 04:53:05 -0400
Received: from [172.16.32.23] ([172.16.32.23]) by nsmail.netscout.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 27 Sep 2011 04:53:05 -0400
Message-ID: <4E818EF3.4090206@netscout.com>
Date: Tue, 27 Sep 2011 14:23:07 +0530
From: nilesh <nilesh.tayade@netscout.com>
Organization: NetScout
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13
MIME-Version: 1.0
To: tls@ietf.org
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 27 Sep 2011 08:53:05.0343 (UTC) FILETIME=[DF1384F0:01CC7CF2]
X-TM-AS-Product-Ver: SMEX-10.0.0.4152-6.800.1017-18410.004
X-TM-AS-Result: No--14.394800-8.000000-31
X-TM-AS-User-Approved-Sender: No
X-TM-AS-User-Blocked-Sender: No
X-Mailman-Approved-At: Tue, 27 Sep 2011 06:51:30 -0700
Subject: [TLS] Query regarding generating client_write_key.
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/tls>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 27 Sep 2011 08:51:44 -0000
Hi, I am new to the TLS/Cryptography and started working on decrypting the packets over SSL/TLS. I have followed the RFC2246, 5246. To start decoding the packets, I need to have symmetric keys (client_write_key/server_write_key). I have the key_block, IV and MAC. As per the rfc: client_write_key = PRF{key_block[32..36], client_random, server_random, some_string}[0..31]; And I have started writing PRF (pseudo-random function) somewhat like: <snip> /* input : has 5bytes data i.e. key_block[32..36]; salt1 == client_random, salt2 == server_random, salt = 'A'. */ for (i = 0; i < 2; i++) { MD5_Init(&md5); MD5_Update(&md5, (unsigned char *) &input[0], 3); // MD5_Update(&md5, shasig, 20); MD5_Final((unsigned char *)&md, &md5); SHA1_Init(&sha); SHA1_Update(&sha, pad, i + 1); SHA1_Update(&sha, (unsigned char *) &input[2], 3); SHA1_Update(&sha, salt1, 32); SHA1_Update(&sha, salt2, 32); SHA1_Final(shasig, &sha); } </snip> Now, we need to XOR the md and shasig to get the bytes in client_write_key. Queries: 1. The md5 generates 16bytes and SHA1 generates 20bytes so xor will be 20bytes. But the key we expect should be 32bytes (iterated the MD5/SHA1 twice for that). How could this be achieved? 2. Any suggestions on if the PRF() is designed somewhere? Pointers on how it could be designed? I tried several ways, but getting the wrong key. Could someone please advice? -- Thanks, Nilesh
- [TLS] Query regarding generating client_write_key. nilesh
- Re: [TLS] Query regarding generating client_write… Simon Josefsson
- Re: [TLS] Query regarding generating client_write… Joshua Davies
- Re: [TLS] Query regarding generating client_write… Joshua Davies
- Re: [TLS] Query regarding generating client_write… nilesh