
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 o2VNNsbK021480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 31 Mar 2010 16:23:54 -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 o2VNNsjp021479; Wed, 31 Mar 2010 16:23:54 -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-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.221.181]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2VNNq3Q021473 for <ietf-openpgp@imc.org>; Wed, 31 Mar 2010 16:23:53 -0700 (MST) (envelope-from singpolyma@gmail.com)
Received: by qyk11 with SMTP id 11so649914qyk.13 for <ietf-openpgp@imc.org>; Wed, 31 Mar 2010 16:23:51 -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:subject :message-id:mime-version:content-type:content-disposition:jabber-id :openpgp:x-url:user-agent; bh=CSVjGqvcG98fM2jYqNpaJ0MX69PaeyO3imfJfAkS48k=; b=WvA+HeFdkj40ycJauBrGTdhhOre4mcJa6pvEsImFhXqrAbvar+tdL+c/pO1AY6onsM i6TIu8pKOtr3o9l5QFYD/FoWquTlLF1a99BP93C+WUrrznD3YphDqO4Ep61h6AVYxym5 iHjkVksZTy1H8PSsNE+NLBQlxrLGQ1NKtgnm4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:jabber-id:openpgp:x-url:user-agent; b=eELOVpNx9pZQ5u4veTCACuOTfe1VCB2y1VLofn+oTT8jE1cntszjMj0OtAj9HrEYVS ay/I9jq6Q2aYUIvWJLwHqce/ZlAJMbkgNRwu/7hHb4H6hxJ6gNqcy251faNpm8jMd2dj VRYKlTCGyLcKUJvUOjsL9gCxxbzjQHqt7wU74=
Received: by 10.224.110.202 with SMTP id o10mr3138777qap.58.1270077831745; Wed, 31 Mar 2010 16:23:51 -0700 (PDT)
Received: from localhost ([66.49.154.250]) by mx.google.com with ESMTPS id 21sm153602040vws.2.2010.03.31.16.23.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 31 Mar 2010 16:23:51 -0700 (PDT)
Date: Wed, 31 Mar 2010 18:24:03 -0500
From: Stephen Paul Weber <singpolyma@singpolyma.net>
To: ietf-openpgp@imc.org
Subject: S2K Question
Message-ID: <20100331232403.GA28458@mediacentre>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed
Content-Disposition: inline
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

I think I get simple and salted, but iterated and salted is a bit complex.

Is it:

key = "";
count = ((Int32)16 + (c & 15)) << ((c >> 4) + 6);
for(i = 0; i < count; i++) {
	key = hash_function(strcat(key, passphrase[i]));
}

- -- 
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)

iQIcBAEBCAAGBQJLs9mTAAoJENEcKRHOUZzepXQP/3vuO49/kEEZ00RQTnnCdr5s
50YBdCHwlpnfm0Wmz5ZSUFkNqhjcTRwjSOraVD4xvD3aNFPyUVmijtylFcQo2Dan
2aJK/+mhKTH8phCkB6SCaTT8QI1HjNnIHUbteQGDofKLmppVMK/nJEZCshKxnA5V
5LE4tzlVyqMTKkzxGCXPqXpKvJTvPFH1G8QfLYiTC5o2/ZhS+fn3OZdd7egWECIy
YE7VICb1h4lPzvEg4n/nQA+l5SoZsUW12BsFTDtuCJlspGvXLQteiRmKVEPtbKMt
2gfBnNkroQISVjEnn07WP8GQnVDT6TaStLDNuZenKoh/+82J6nMtDthtKmV8stPY
XbWsVHyR99CT1q3nZa8xAeLv7dbaud0cujUSShpdnaeq/5erfbbxiD97rwjfh06L
hhmg9XgUrM0UgMbqlHSZRZNyhdqNtt3bmXnahm0LyMGOQkxa5kFJwJHKvrXWqPrR
LPRKTqMtbT9FkadjCk5w/gjGYjd6+DSzrDMpe8BUipMHWSzlpd8F35930QB5btg7
GiAnZnsSSxb4DIbZ6sNfpYtHLJPpbR6+sfNK+W7ILwb/ERMVu7Q0SFuOzy/0Yf6z
AILiD5VbQc5vsrEN5GfOnDlb/deM5kWcm0xqdvCZXMZQO5m6AqOoBKj/XXtLcyNL
GMczfpW286Z1aqla3SE3
=OpkO
-----END PGP SIGNATURE-----



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 includin=
g 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: 0x0=
4, 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 byte=
s).

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!

- --=20
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
=3DTZ00
-----END PGP SIGNATURE-----



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 o2V1rmAo043236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Mar 2010 18:53:48 -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 o2V1rm0J043234; Tue, 30 Mar 2010 18:53:48 -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 walrus.jabberwocky.com (walrus.jabberwocky.com [173.9.29.57]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2V1rk10043226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <ietf-openpgp@imc.org>; Tue, 30 Mar 2010 18:53:47 -0700 (MST) (envelope-from dshaw@jabberwocky.com)
Received: from grover.home.jabberwocky.com (grover.home.jabberwocky.com [172.24.84.28]) by walrus.jabberwocky.com (8.14.3/8.14.3) with ESMTP id o2V1rjNA022208; Tue, 30 Mar 2010 21:53:45 -0400
Subject: Re: Question about verifying signatures
Mime-Version: 1.0 (Apple Message framework v1078)
Content-Type: text/plain; charset=us-ascii
From: David Shaw <dshaw@jabberwocky.com>
In-Reply-To: <20100330202049.GA21672@mediacentre>
Date: Tue, 30 Mar 2010 21:53:45 -0400
Cc: ietf-openpgp@imc.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <5FEFDF51-313E-4247-A813-CA8B0195F071@jabberwocky.com>
References: <20100330202049.GA21672@mediacentre>
To: Stephen Paul Weber <singpolyma@singpolyma.net>
X-Mailer: Apple Mail (2.1078)
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>

On Mar 30, 2010, at 4:20 PM, Stephen Paul Weber wrote:

> I'm reading RFC4880 in an attempt to produce an implementatdion of a =
subset
> of OpenPGP (RSA signatures) using <http://phpseclib.sourceforge.net/>. =
 I
> have the publickey and compression-literal-signature packets parsed =
out.  I
> can extract n and e and feed them to Crypt_RSA to construct a =
verifier.  I
> tell it I'm using sha256.  It then needs a "message" and a "signature"
> parametre.  I get the signature data out of the signature packet no =
problem.
> The question I have is: what is "message"?  According to section 5.2.4 =
it's
> some combination of the literal data packet(s?) (their bodies or the =
whole
> packet?) and the "hashed" subpackets.  Do I just concat all the data =
packets
> and the hashed packets together in the order they appear?

Basically, yes.

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).

Note that the data (literal packet contents) might be tagged as binary =
(0x00) or text (0x01) (the tag is in the literal packet header).  They =
are the same, except that text has its line endings canonicalized to =
CRLF.

David



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 o2V1kp8p042912 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Mar 2010 18:46:51 -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 o2V1kppe042911; Tue, 30 Mar 2010 18:46:51 -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-vw0-f43.google.com (mail-vw0-f43.google.com [209.85.212.43]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2V1knPR042904 for <ietf-openpgp@imc.org>; Tue, 30 Mar 2010 18:46:50 -0700 (MST) (envelope-from singpolyma@gmail.com)
Received: by vws6 with SMTP id 6so3314182vws.16 for <ietf-openpgp@imc.org>; Tue, 30 Mar 2010 18:46:49 -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:in-reply-to:jabber-id:openpgp:x-url:user-agent; bh=zLTkPx5j9Ivi8eykm8Q4gmqkG/1TKV4e+8J67wO8y6w=; b=Zj2oZKjJxwdGJLLUfHA/GsPJfRr/rj0Cz9rEZ6puMihcJeS9ANzMM6WIj560YVFkmc aW/FJaLeWFhr9yiwxYvW7UlkQr7gEt0VVfRnIgOm9bKoWbJwpqwr5b/u2/KT9xoHLpTb xMAdyMkc75NXf4hEwyXQcJF3WWEo/qiXmhuYw=
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:in-reply-to:jabber-id:openpgp :x-url:user-agent; b=DJcx2qrQCvS5CIdkwFAy2dIEQ85/8wpzPSVrlaYBE2Z6COhMnFLxlbabSnrw0owteS gNtZr3/A5OWY9pPvCUc6fFd0niwAgFKRj7/Be8HPpRG2q6aQML1XjGUaKar6ribdnnJ2 BWcOAyvXWxC17xiToZ3SIPYuhCkrXCxGSyDKY=
Received: by 10.220.62.77 with SMTP id w13mr353620vch.202.1270000008853; Tue, 30 Mar 2010 18:46:48 -0700 (PDT)
Received: from localhost ([66.49.154.250]) by mx.google.com with ESMTPS id 34sm132118109vws.8.2010.03.30.18.46.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 30 Mar 2010 18:46:47 -0700 (PDT)
Date: Tue, 30 Mar 2010 20:46:52 -0500
From: Stephen Paul Weber <singpolyma@singpolyma.net>
To: Wim Lewis <wiml@hhhh.org>
Cc: ietf-openpgp@imc.org
Subject: Re: Question about verifying signatures
Message-ID: <20100331014652.GA5715@mediacentre>
References: <20100330202049.GA21672@mediacentre> <Pine.NEB.4.64.1003301503480.14845@photomat-new.hhhh.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed
Content-Disposition: inline
In-Reply-To: <Pine.NEB.4.64.1003301503480.14845@photomat-new.hhhh.org>
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 Wim Lewis wrote:
> I agree that paragraph isn't completely unambiguous. IIRC, the data
> passed to the SHA1/MD5/whatever algorithm is the bare document
> contents (possibly with EOL canonicalization as described above),
> concatenated with some "trailer" bytes which depend on the version
> number of the signature, but are a copy of part of the signature
> subpacket itself plus perhaps a length field and so on (see the last
> three paragraphs of [5.2.4]).

So, I'm concatenating:

* The literal contents of any literal data packet(s).
* The literal bytes of the signature packet up to and including the "hashed"
  subpackets
* 0x04
* 0xFF
* The length of the second thing in this list

As the "message" to hash?  I'm going to try that.

- -- 
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)

iQIcBAEBCAAGBQJLsqmMAAoJENEcKRHOUZzezXEQAKs9UZu6GBYlhAyeBnfFOKLK
jYoh03l6NoeNGK9LW2NHVFPgasg+NW3hNNoc2F/ZcyxX9t9HUDliNH+eINyWIUao
SHTO1oCiO+DcJu12HZgbAVIp7KkYXhcXJB9ql5dEJo5Ux0xAXTAf5r3Cjn2C5fvS
gzCJRezT7UQp30h/PlWs0RgF3/Vn3re/EuDO4SGdtYuVl73mB2zSB2TXHRBbJD97
79ZqzZQLYGQ81MRZ5IBdGTy3kFHKCijrFfsDiWyqxddrKaU3qGluKDAzH7RD1rpY
9bfKnvFm0J0Pi2w9ZyIhO0/aZVqNqtfzhAFAjfaN6fX+Dla+/3uUNp+tCaHVNIhf
9LCxIpcw4i0QKmIUDM3o8ppxba8dm8mlfFJ0kuYjIJFrI4G4hEcoywEqmM6LO+9J
uchOHAtNl8g9mixnG2Q+TSd1CrDqpyL2Y/xGfDH2enSU/Lic68uFs9mGMeLYNMdT
Yru4J/NxVS9G+bCD3mmnie7wZBeUsJdbYRhRZJPglAJNhGxDljpGakHeDN9fvTCA
FtKTsCBATvhho41Q5wig9guMbZYKD2DQQwvXx7QGy2DM/SnAncAKM1dP7xQgtwhX
s8ytm6L5LTH4OCTaMdSsZoigwympU9oh+ACnic6Z8uRvPLDyZFvGFSRkWPy943kr
mbrIKJFPQb+ND2Kf1hqv
=x0Q1
-----END PGP SIGNATURE-----



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 o2UMI4xQ032918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Mar 2010 15:18:04 -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 o2UMI4gu032917; Tue, 30 Mar 2010 15:18:04 -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 photomat.hhhh.org (photomat.hhhh.org [207.202.171.41]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2UMI2lJ032910 for <ietf-openpgp@imc.org>; Tue, 30 Mar 2010 15:18:03 -0700 (MST) (envelope-from wiml@hhhh.org)
Received: by photomat.hhhh.org (Postfix, from userid 4395) id 46CB53C83E; Tue, 30 Mar 2010 15:18:28 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by photomat.hhhh.org (Postfix) with ESMTP id 325D63C839; Tue, 30 Mar 2010 15:18:28 -0700 (PDT)
Date: Tue, 30 Mar 2010 15:18:28 -0700 (PDT)
From: Wim Lewis <wiml@hhhh.org>
To: Stephen Paul Weber <singpolyma@singpolyma.net>
cc: ietf-openpgp@imc.org
Subject: Re: Question about verifying signatures
In-Reply-To: <20100330202049.GA21672@mediacentre>
Message-ID: <Pine.NEB.4.64.1003301503480.14845@photomat-new.hhhh.org>
References: <20100330202049.GA21672@mediacentre>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
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>

On Tue, 30 Mar 2010, Stephen Paul Weber wrote:
> The question I have is: what is "message"?  According to section 5.2.4 it's
> some combination of the literal data packet(s?) (their bodies or the whole
> packet?) and the "hashed" subpackets.  Do I just concat all the data packets
> and the hashed packets together in the order they appear?

Section [5.2.4] says:
> For binary document signatures (type 0x00), the document data is
> hashed directly.  For text document signatures (type 0x01), the
> document is canonicalized by converting line endings to <CR><LF>,
> and the resulting data is hashed.

I agree that paragraph isn't completely unambiguous. IIRC, the data passed 
to the SHA1/MD5/whatever algorithm is the bare document contents (possibly 
with EOL canonicalization as described above), concatenated with some 
"trailer" bytes which depend on the version number of the signature, but 
are a copy of part of the signature subpacket itself plus perhaps a length 
field and so on (see the last three paragraphs of [5.2.4]).

(The encrypted-data packet, by contrast, does contain a sequence of 
OpenPGP packets.)



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 o2UKKpr3027207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Mar 2010 13:20:51 -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 o2UKKp4x027206; Tue, 30 Mar 2010 13:20:51 -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 fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.157]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id o2UKKnk7027200 for <ietf-openpgp@imc.org>; Tue, 30 Mar 2010 13:20:50 -0700 (MST) (envelope-from singpolyma@gmail.com)
Received: by fg-out-1718.google.com with SMTP id d23so210298fga.4 for <ietf-openpgp@imc.org>; Tue, 30 Mar 2010 13:20:49 -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:subject :message-id:mime-version:content-type:content-disposition:jabber-id :openpgp:x-url:user-agent; bh=gArS8Avzbuso1K1Pj+2BiC+Wt7vM3dp/Z8VREVhsXQI=; b=MFIrLYXRK33CSmNU2z/+Y9Qdp9wy61/JJ4NnxVr+vNYiaDt1SY3evmcDp7r6r/mYiH LxQQ060jMxs2Jbcu1r+S9nMYQVCtpSjAr6/YYYVtmkz4J/rho3V6orWWFDJrAITqM7CU eQtLEtjm6kChmohzE5QqUMZDmEA9wsTyRAGkk=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition:jabber-id:openpgp:x-url:user-agent; b=pY2LJuNsa0M/cfJm99JdF1k/fHcPcsFZBmhleS2l9OeNtZ/AHG+t9C875YkGnZF2PR /9CvntJ69Fxxyr39ldQ5wzv52FjFWCH0FOU4r5yU+MC4VdNjboRg+mjEAY462z3nBdV4 HdQUWMrPG9P6dO2OYoNq8AhQBTbDY/4rHmVXg=
Received: by 10.87.74.30 with SMTP id b30mr6940723fgl.6.1269980449040; Tue, 30 Mar 2010 13:20:49 -0700 (PDT)
Received: from localhost ([66.49.154.250]) by mx.google.com with ESMTPS id 15sm4309019fxm.3.2010.03.30.13.20.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 30 Mar 2010 13:20:47 -0700 (PDT)
Date: Tue, 30 Mar 2010 15:20:49 -0500
From: Stephen Paul Weber <singpolyma@singpolyma.net>
To: ietf-openpgp@imc.org
Subject: Question about verifying signatures
Message-ID: <20100330202049.GA21672@mediacentre>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; x-action=pgp-signed
Content-Disposition: inline
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

I'm reading RFC4880 in an attempt to produce an implementatdion of a subset
of OpenPGP (RSA signatures) using <http://phpseclib.sourceforge.net/>.  I
have the publickey and compression-literal-signature packets parsed out.  I
can extract n and e and feed them to Crypt_RSA to construct a verifier.  I
tell it I'm using sha256.  It then needs a "message" and a "signature"
parametre.  I get the signature data out of the signature packet no problem.
The question I have is: what is "message"?  According to section 5.2.4 it's
some combination of the literal data packet(s?) (their bodies or the whole
packet?) and the "hashed" subpackets.  Do I just concat all the data packets
and the hashed packets together in the order they appear?

Thanks.

- -- 
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)

iQIcBAEBCAAGBQJLsl0hAAoJENEcKRHOUZzeeiEQALIrdMesbnGdz28npdEDun6U
JyZP+WpUBI0RFESTs3VNTkvvxnNOCuQrg6PDHn10b/06b3hgbpicplAWBglGJSHd
P7/0CG4ADa3yTapyEKZy9lKbjj6s5gUuz6PJVvw+Ph5XIxDfNM3EHRSoHZERaPPI
Cs7ohUE7sxLO2Q8AYxwAQelWdzhCOONDq4WFciXp+ziI9lFVKgZKxFVAOvOLwi3s
EFDpV/6qoVWC5XBJhZPbwHcOaLbBVGwSDnA+lI1JCwtdN1HGsQnnD3fvMSjGsICv
+skfheEpoQI2x8WBq928d5cbuxQaTVKY3aHFT8DyjROUv6tAwaMWObCJ5/+GEy/8
YNAx/ba/NdCBHYFFySlvVV7xvKCeT19t9LeEKys8fbIcrNj3ULP5cNro6hfTc+2d
zu4VcbWIiJ57MuGFks15ear+6O1UN5JLGTSkz1aQx4Tb+5TqliwWRsu+tSJWlUK8
LY5BFf5AZ5w5GF0aGWMMfNj3mHkMkeqL2q1LXoIW9qjikCZRLksn4umS4mf3pM5T
1tEJJ/zfdAeP/4fKrV97vi1Ez7IbOCu+JheRwANTUbdQNWg5ajFF5uf2zxHKsKUN
gRlFzVVgBK4oJyF3tx13oBKFEV8I6B6fhtGi7pkikI6R0UyAklD0jkGMJuD2i3FQ
Gl/I+wEUGcvsdTFQxK5B
=HiOM
-----END PGP SIGNATURE-----


