Sign a mail

André Rothe arothe at phosco.info
Mon Jul 20 17:19:55 CEST 2009


Hello!

I try to send emails from an application, which should be signed with  
gpg. But I'm not sure, which part of the mail is used for signing.

A PGP/MIME mail consists of:

MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;  
protocol="application/pgp-signature";  
boundary="------------248101390272"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------248101390272
Content-Type: multipart/mixed;
	boundary="----=_Part_0_22676229.1248101390164"

This is a multi-part message in MIME format
------=_Part_0_22676229.1248101390164
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

This is a test.

------=_Part_0_22676229.1248101390164
Content-Type: image/jpeg; name=image001.jpg
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=image001.jpg

**some image data**
------=_Part_0_22676229.1248101390164--

--------------248101390272
Content-Type: application/pgp-signature; name="signature.asc"
Content-Transfer-Encoding: 7bit
Content-Description: OpenPGP digital signature
Content-Disposition: attachment

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: not valid

iEtEABEIAAYFAkpkhA4ACgkQIAQxWaS9SwJgcgCgqx5/ejuMjr3RtAMUCHZ2kmax
XEgAn2qZkveAbxrwv0ZYSEpxiNcQEhDY
=XqNu
-----END PGP SIGNATURE-----

--------------248101390272--

I use the lines (inclusive) from

Content-Type: multipart/mixed;

to

------=_Part_0_22676229.1248101390164--

to sign the mail. But always I get an invalid signature. Has anyone an idea?

Thanks a lot
Andre



More information about the Gnupg-devel mailing list