Subject: Re: Re[2]: OpenPGP Signing of HTTP POST

From: [email-masked] ("Hal Finney")
Date: Wed, 7 Mar 2007 11:42:07 -0800 (PST)

"Nickolay L." <[email-masked]> writes:
> For example, we can do as following :
>
>    POST /pba/postverify.php HTTP/1.1
>    X-PGP-Message: Cleartext-Signed
>    X-PGP-Signature-Hash: SHA1
>    X-PGP-Signature-Version: GnuPG v1.4.6 (GNU/Linux)
>    X-PGP-Signature-Comment: POST signed using Enigform
>    X-PGP-Signature: iD4DBQFFyMVnAlpOsGhXcE0RAmpcAJ9Lkqd/PZqVV/hoPFSoFZxizECKHwCY/rWd
>    Z5AuIplmYgUFhTU3x3Sq9g==
>    Host: localhost
>    ...

You might want to look at the X-PGP-Sig: header which has been used
for some years to sign Usenet (newsgroup) posts.  Unfortunately I can't
find any documentation of it but if you Google x-pgp-sig you will find
for example an Emacs macro which inserts it, part of the Ubuntu Linux
distribution.  Here is a sample which was posted to this list several
years ago:

X-PGP-Sig: 2.6.3ia Subject,From,X-Mailer
        iQCVAwUBM84wngE7m572a9utAQETEgQAwcL38QVdZbkHuW4Mblmje17deuI85R1j
        4yGiDlb1enRDSUyGiLCmk8YphNDiLdKKlMV3Z0opzREUW9Q+sb8fr5s1QXMJhvXs
        7hi7s4+V00rjgbqbqXVNiajKiKfVxd7JTRfe0UIZuOljnURP1ZCMlSRD1rDoCEAg
        1vunQv6QYj4=
        =hvn0

I think the idea is that you can sign not only the message contents, but
selected headers as well.

Hal Finney

---

From: Johan van Selst <[email-masked]>
Date: Wed, 7 Mar 2007 21:29:47 +0100

"Hal Finney" wrote:
> find any documentation of it

A nice desciption of background and the actual format can be found here,
http://archives.eyrie.org/software/pgpcontrol/FORMAT

Johan

---

From: "Arturo 'Buanzo' Busleiman" <[email-masked]>
Date: Wed, 07 Mar 2007 18:27:15 -0300

> selected headers as well.

That's... QUITE interesting!

- --
Arturo "Buanzo" Busleiman - Consultor Independiente en Seguridad Informatica
Enigform - Nueva Seguridad al navegar: http://enigform.mozdev.org
Mail Hosting Seguro y Consultoria - http://www.buanzo.com.ar/pro/

---

From: "Arturo 'Buanzo' Busleiman" <[email-masked]>
Date: Thu, 08 Mar 2007 10:39:21 -0300

Current Status:

I'm rewriting Enigform to use a backwards-compatible methodology, by using the X-PGP-Sig header,
which will ONLY contain the signature. Signed elements will be kept in a separate header,
X-PGP-Sig-Elements.

I expect to have a working version by tomorrow (or today, it's raining in Buenos Aires, so...!).

I'll update the Draft ASAP.

Thanks for all the input so far!

- --

---

From: Simon Josefsson <[email-masked]>
Date: Thu, 08 Mar 2007 16:11:39 +0100

> I expect to have a working version by tomorrow (or today, it's raining in Buenos Aires, so...!).

If you are considering turning that work into draft form, consider
looking at the OpenPGP: header too:

http://josefsson.org/openpgp-header/

I'm confused whether your efforts is a discussion about one
implementation, or whether you have standardization goals here.

The OpenPGP: header do not support signing of header elements,
however.  The reason is that mail gateways are known to modify header
elements, causing the OpenPGP signature to fail.

Instead, if you want to protect header fields, you would sign the
entire message as a message/rfc822 MIME body part and include it in
the e-mail.

What is lacking for this alternative approach to interop is guidelines
to specify that MUAs should replace the outer headers with the inner
ones for display purposes.  The same affect S/MIME too.  Perhaps it is
time to revise RFC 1847 and add a discussion about this?  Are people
interested in working on this?  Some people have been recommending
signing message/rfc822 for several years, but it is not that
well-defined exactly how that should work, and there is no RFC to
reference either.

/Simon

---

From: "Arturo 'Buanzo' Busleiman" <[email-masked]>
Date: Thu, 08 Mar 2007 13:00:41 -0300

> looking at the OpenPGP: header too:

Great, I'll check it out later.

> implementation, or whether you have standardization goals here.

Enigform = Mozilla Firefox Extension = "Reference Implementation" goal.
Draft = Standarization goal.

> entire message as a message/rfc822 MIME body part and include it in

The problem is that this is for HTTP, not for eMail.

- --

---

From: "Arturo 'Buanzo' Busleiman" <[email-masked]>
Date: Thu, 08 Mar 2007 15:18:19 -0300

> I expect to have a working version by tomorrow (or today, it's raining in Buenos Aires, so...!).

Okey, I've finished adding the new features. This is how a signed POST request from browser to
server now looks. Pay attention to the X-PGP-* headers and values. Some lines could've been wrapped.

==cut here==
POST /pba/postverify.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070226 Firefox/2.0.0.2
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/pba/
X-PGP-Sig-Fields: body
X-PGP-Sig: iD8DBQFF8FIZAlpOsGhXcE0RAh9WAJ42Zo2Sqapu1WXYLF9+lHQd5zAPfQCePIovixLWkMbebF2NTjo3WrVEZNA==q/ix
X-PGP-Version: GnuPG v1.4.6 (GNU/Linux)
X-PGP-via: Enigform for Mozilla Firefox
Content-Type: application/x-www-form-urlencoded
Content-Length: 17

variable=somedata
==cut here==

Of course, the X-PGP-Sig header value must be splitted in 3 strings to reconstruct the detached
signature, in chunks of 64, 24 and 5 characters (without the \r\n), respectively. The headers, when
combined to form a detached signature, would look like this:

- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF8FIZAlpOsGhXcE0RAh9WAJ42Zo2Sqapu1WXYLF9+lHQd5zAPfQCePIov
ixLWkMbebF2NTjo3WrVEZNA=
=q/ix
- -----END PGP SIGNATURE-----

This is much more backwards compatible, and more geared towards standarization. I'll modify the
Draft asap to include these changes.

- --