Re: Question about verifying signatures

Stephen Paul Weber <singpolyma@singpolyma.net> Wed, 31 March 2010 15:04 UTC

Received: from balder-227.proper.com (localhost [127.0.0.1]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2VF4P7l090830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Mar 2010 08:04:25 -0700 (MST) (envelope-from owner-ietf-openpgp@mail.imc.org)
Received: (from majordom@localhost) by balder-227.proper.com (8.14.2/8.13.5/Submit) id o2VF4Pgv090829; Wed, 31 Mar 2010 08:04:25 -0700 (MST) (envelope-from owner-ietf-openpgp@mail.imc.org)
X-Authentication-Warning: balder-227.proper.com: majordom set sender to owner-ietf-openpgp@mail.imc.org using -f
Received: from mail-pw0-f43.google.com (mail-pw0-f43.google.com [209.85.160.43]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2VF4NX1090820 for <ietf-openpgp@imc.org>; Wed, 31 Mar 2010 08:04:23 -0700 (MST) (envelope-from singpolyma@gmail.com)
Received: by pwj6 with SMTP id 6so174686pwj.16 for <ietf-openpgp@imc.org>; Wed, 31 Mar 2010 08:04:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:date:from:to:cc :subject:message-id:references:mime-version:content-type :content-disposition:content-transfer-encoding:in-reply-to:jabber-id :openpgp:x-url:user-agent; bh=Y8dYn8kzjTOqiPx5KLrrhu41CVH3DXXNuyzeRmq451w=; b=TTjkPhSPfFzcyWD8MMpIPVeoNx2oeBgH3sE4mQUa2TkX2UJYYGux9sFowgGj4chWe1 nGp24v/Gr5Fp6kKuQEHfi3VULIUq2qv/oS2XH+3yvmWYmeBe3j3NnNeH8KNid1xjKe67 SVZKWArsqMa4mJGELG6Fpk7K1agedc8dRFG4I=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:jabber-id:openpgp:x-url:user-agent; b=G8wtoYjEmzdTtPdcm1CA9GURVPHHHQShcuyE7RvPV8E3nLucWX83MEFXN4nnFCm2Zj IN8QJIPZQm/0saFkpHquJgxmcEaueC6HAkLS3Acdj90KbLt/eno+jEA6jcNEoCKJET6u +jYW8WY7l9R+7XsI5eQlScuPSR3mTqvNObixY=
Received: by 10.141.214.22 with SMTP id r22mr2836043rvq.165.1270047448482; Wed, 31 Mar 2010 07:57:28 -0700 (PDT)
Received: from localhost ([66.49.154.250]) by mx.google.com with ESMTPS id 15sm1614302pwi.2.2010.03.31.07.57.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 31 Mar 2010 07:57:26 -0700 (PDT)
Date: Wed, 31 Mar 2010 09:57:33 -0500
From: Stephen Paul Weber <singpolyma@singpolyma.net>
To: David Shaw <dshaw@jabberwocky.com>
Cc: ietf-openpgp@imc.org
Subject: Re: Question about verifying signatures
Message-ID: <20100331145733.GA7308@mediacentre>
References: <20100330202049.GA21672@mediacentre> <5FEFDF51-313E-4247-A813-CA8B0195F071@jabberwocky.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; x-action="pgp-signed"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
In-Reply-To: <5FEFDF51-313E-4247-A813-CA8B0195F071@jabberwocky.com>
Jabber-ID: singpolyma@gmail.com
OpenPGP: id=CE519CDE; url=https://singpolyma.net/public.asc
X-URL: https://singpolyma.net
User-Agent: Mutt/1.5.20 (2009-06-14)
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>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Somebody claiming to be David Shaw wrote:
> To paraphrase 5.2.4, and assuming we're talking about V4 signatures, you take all the data (just the uncompressed literal packet body - not including the literal packet header), and follow that with the signature version (1 byte), the signature type (1 byte), the public-key algorithm (1 byte), the hash algorithm (1 byte), the hashed subpacket length (2 bytes, big endian), and the hashed subpacket body (however many bytes).  Note that these are the first n bytes of your signature packet.  Then you hash the trailer: 0x04, 0xFF, and a four byte big-endian number which is the number of bytes you hashed from the signature (i.e. 6 bytes, plus the number of subpacket bytes).

I've finally got one to work.  The "message" that the signature is over
seems to be the concatenation of the literal data in the literal packet (not
header or filename or timestamp) with the bits in your message, in that
order.

Thanks for all the help!

- -- 
Stephen Paul Weber, @singpolyma
Please see <http://singpolyma.net> for how I prefer to be contacted.
edition right joseph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQIcBAEBCAAGBQJLs2LdAAoJENEcKRHOUZzeDDgP/jP4lwp+HC4OJesxiq80wbzv
bJdJAqefeg539GwMDUb/ZNIqhhpYR25DgtZPBbgtY1kEWzY8zSdiuo4E125QyjgB
hUw1oKv3GFxGMUI2f9Q6Vgpiek1rNamlhtswCXHI7Vv7DA7G8cwm2ctWYQ5F848/
xinyP424AwZfAyL0LyK30zkiDbEtA217jH87GrDm/8e+P+mCd/YBQuOjX3MRbAnP
V9YhNoV+ysTL4VOx1Br4GkMR/OOsFUvPs3QXZh/5DKe3+GQy3fRY4h+GG1h+fp1W
EEAUnL2d87I9FvAGKEHEd9gZiabu5X7ZhwX3cCFM+cUlWoBygaExvmcZzd/+EFGP
hUeAYl+f45gAPcPRjucHJNpIWHNfbH2XD6os2psUK3JAvmbOeGPCBNPQZhaSSJB7
P1xiTUbCltK12f+STBB6NwSH3whTxZfm7wi8y0SY0HxAn3nSP4p7m8RQqI0SfZ5T
RGA2ERe9/n9LXprUgBG6ltjo8zFTDAhh98T7a20nLVYHu4UqrSheAOL67ZxX4tcI
Esv67a0MPpq5AclqaE7Y2rnF8HLs/keBg7gfK43/9rn+/9QugekIwRfFklvknPTJ
LUSleHr72qqdrohO8OT6hvRN7liCManaDMn0VQkrmxjQ3qgp7wowcseecZkvvn32
qumsZvwdGwQjwH1mKx0H
=TZ00
-----END PGP SIGNATURE-----