Sign a multipart/alternative mail

Ingo Klöcker kloecker at
Wed Nov 2 23:03:07 CET 2011

On Thursday 27 October 2011, Pascal Nitsche wrote:
> Am 26.10.2011 22:03, schrieb Ingo Klöcker:
> > On Wednesday 26 October 2011, Pascal Nitsche wrote:
> >> Hello folks,
> >> 
> >> 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.


> > You also do not mention whether you remove trailing whitespace. If
> > you quoted-printable encode trailing spaces as =20 then you do not
> > need to remove it.
> Hello Ingo,
> thanks for your help. I found out about this yesterday evening myself
> through (It's only logical if you think about it...) I just thought
> of the message content another way at first.
> Also thanks for the tip with the trailing whitespaces, I'll test
> it... But there shouldn't be whitespaces after the last boundary
> line of the message or is this considered to be done for each line
> and not just for the last one of the message to be signed?

This has to be done for each line.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/attachments/20111102/1a053877/attachment.pgp>

More information about the Gnupg-users mailing list