Sign a multipart/alternative mail
pascal.nitsche at fansubcode.org
Wed Oct 26 11:18:35 CEST 2011
I'm trying to sign a mail of the mime type "multipart/alternative" using
pgp in PHP.
The generation of the signature and the correct boundaries works just
fine, but I can't bring it to generate a valid signature.
I think I'm missing something important here.
First of all I encode the text and html portions of the mail as
quoted-printable and replace every new line character with <CR><LF> as
to be found in the RFCs (which seem not to state anything about multipart).
Now I generate the signature of the complete mime part and put it into
its own mime part.
So now the mail looks like this (text, html and signature were replaced
by placeholders for readablility and not all of the mail headers are
shown since only the Content-Type should matter here):
|Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=_1b5364229a82b654fad7cf2aa969f02e"
This is a message in Mime Format. If you see this, your mail reader does not support this format.
&Content-Type: text/plain; charset=UTF-8
&PLAIN TEXT CONTENT ENCODED IN QUOTED PRINTABLE
&Content-Type: text/html; charset=UTF-8
&HTML CONTENT ENCODED IN QUOTED PRINTABLE
Content-Type: application/pgp-signature; name="signature.asc"
Content-Disposition: attachment; filename="signature.asc"
Content-Description: OpenPGP digital signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
PGP SIGNATURE HERE
-----END PGP SIGNATURE-----
The lines starting with the &-sign were used to generate the signature.
As stated I think I missed something or did not understand something
correctly so please light it up for me ;)
Thanks for your help in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gnupg-users