[imp] 2 PGP and SMIME problems

Chris Hastie lists at oak-wood.co.uk
Tue Jan 14 08:26:08 PST 2003


On Mon, 13 Jan 2003, Michael M Slusarz <slusarz at bigworm.colorado.edu> 
wrote
>Quoting Chris Hastie <lists at oak-wood.co.uk>:
>
>| On Mon, 13 Jan 2003, Didi Rieder <adrieder at sbox.tugraz.at> wrote
>| >1.
>| >I noticed, that when I send a PGP signed message blank lines in this
>| message are
>| >going to be discarded, so that all the message text sticks together.
>|
>| Appears to be due to lines 1134 - 1136 in lib/MIME/Part.php, in the
>| transferEncode() function:
>|
>|                  if (!empty($current_line)) {
>|                      $output .= $current_line . $eol;
>|                  }
>|
>| Testing that $current_line is not empty results in empty lines being
>| dropped. Dropping the if condition improves this, but probably breaks
>| something else I don't know about :)
>
>I can't reproduce this - newlines in PGP messages display fine for me.

The problem is not with new lines, it's with blank lines - ie two new 
lines with nothing in between. This

|This is a test.
|
|Thank you.

becomes

|This is a test.
|Thank you.

>There is definitely nothing wrong with the code snippet listed above either.

It may be correct for somethings, but it is causing the problem. Bunging 
various echo statements into signMIMEPart() in lib/Crypt/pgp.php it is 
clear that the problem becomes a problem after the

$mime_part->setTransferEncoding('quoted-printable');

line.

When the part gets to transferEncode and goes through QP encoding, the 
code snippet quoted will remove blank lines. I wondered if the empty 
test was necessary in order to prevent additional blank lines getting 
added to QP messages if the line length was exactly 76 characters, but 
looking more carefully at the code I don't think this would be a 
problem.

The empty test is certainly the cause of missing blank lines in signed 
messages, removing it certainly solves that problem and as far as I can 
see will not cause any others.
-- 
Chris Hastie


More information about the imp mailing list