Re: V3 secret keys

Ben Laurie <ben@algroup.co.uk> Thu, 16 February 2006 11:13 UTC

Received: from odin.ietf.org ([132.151.1.176] helo=ietf.org) by megatron.ietf.org with esmtp (Exim 4.32) id 1F9h4d-0008EY-K9 for openpgp-archive@megatron.ietf.org; Thu, 16 Feb 2006 06:13:24 -0500
Received: from above.proper.com (above.proper.com [208.184.76.39]) by ietf.org (8.9.1a/8.9.1a) with ESMTP id GAA11573 for <openpgp-archive@lists.ietf.org>; Thu, 16 Feb 2006 06:11:36 -0500 (EST)
Received: from above.proper.com (localhost.vpnc.org [127.0.0.1]) by above.proper.com (8.12.11/8.12.9) with ESMTP id k1GAvLtO043270; Thu, 16 Feb 2006 02:57:21 -0800 (PST) (envelope-from owner-ietf-openpgp@mail.imc.org)
Received: (from majordom@localhost) by above.proper.com (8.12.11/8.12.9/Submit) id k1GAvLZS043269; Thu, 16 Feb 2006 02:57:21 -0800 (PST)
X-Authentication-Warning: above.proper.com: majordom set sender to owner-ietf-openpgp@mail.imc.org using -f
Received: from mail.links.org (mail.links.org [217.155.92.109]) by above.proper.com (8.12.11/8.12.9) with ESMTP id k1GAvIc1043262 for <ietf-openpgp@imc.org>; Thu, 16 Feb 2006 02:57:19 -0800 (PST) (envelope-from ben@algroup.co.uk)
Received: from [193.133.15.218] (localhost [127.0.0.1]) by mail.links.org (Postfix) with ESMTP id 1302833C44; Thu, 16 Feb 2006 10:57:17 +0000 (GMT)
Message-ID: <43F45B0E.7010009@algroup.co.uk>
Date: Thu, 16 Feb 2006 10:59:26 +0000
From: Ben Laurie <ben@algroup.co.uk>
User-Agent: Thunderbird 1.5 (Windows/20051201)
MIME-Version: 1.0
To: Hal Finney <hal@finney.org>
CC: ietf-openpgp@imc.org
Subject: Re: V3 secret keys
References: <20060215201341.0D48557FAE@finney.org>
In-Reply-To: <20060215201341.0D48557FAE@finney.org>
X-Enigmail-Version: 0.93.0.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Sender: owner-ietf-openpgp@mail.imc.org
Precedence: bulk
List-Archive: <http://www.imc.org/ietf-openpgp/mail-archive/>
List-Unsubscribe: <mailto:ietf-openpgp-request@imc.org?body=unsubscribe>
List-ID: <ietf-openpgp.imc.org>
Content-Transfer-Encoding: 7bit

Hal Finney wrote:
> Ben Laurie writes:
>> No, I can't confirm that. I have code that works as we all expect CFB to
>> work (modulo "resync") on v4 secret keys. I had to make the change I
>> described to decrypt v3 keys. It seems to me rather unlikely that I have
>> it wrong given that I had to reverse engineer and write new code to get
>> a working implementation for v3!
> 
> To clarify, you are claiming that to unlock a V3 secret key, you don't
> use the IV as usual in CFB mode.  Instead, you use an all-zero buffer
> for the IV, and then prepend the IV from the secret key subpacket to
> the data, decrypt that, and discard the first block of output?

Yes.

> So in other words, to get the first block of plaintext you do, in effect:
> 
> buf1 = Enc (all-zeros);
> buf2 = buf1 xor IV;
> buf3 = Enc (buf2);
> buf4 = buf3 xor ciphertext
> 
> and buf4 will be the first block of plaintext?  You say your code does
> this, and it works????
> 
> My code does this:
> 
> buf1 = Enc (IV);
> buf2 = buf1 xor ciphertext
> 
> and buf2 is the first block of plaintext.
> 
> I just checked GPG and I confirmed that they work the same way I have
> said.
> 
> Could you possibly show a few lines of your code, that does this step?
> It's simply impossible for your code to be working as I have described
> above, and to interoperate with existing V3 keys.  Either I misunderstood
> your claim about the need for an all-zero IV, or you have misunderstood
> what your own code is doing.

The code is publicly available: http://openpgpsdk.nominet.org.uk/.

But what I'm going to do is instrument it so we can all see exactly what
is going on. Watch this space :-)

Cheers,

Ben.

-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff