Page 1 of 1

[BUG] GPG encrypted data gets corrupted

Posted: Thu Aug 09, 2007 6:17 am
by furax
I have found that the function encode8Bit (and others I guess) in Encoder.php (line 315) messes an ordinary GPG encrypted text so it becomes unreadable by the recipient.

I have noticed that on such data, the wordwrap function should not be used after the fixLE function. Si I have changed th function to:

Code: Select all

public function encode8Bit($data, $chunk=76, $le="\r\n")
  {
    if(strpos($data, "-----BEGIN PGP MESSAGE-----") === 0)
    	return $this->fixLE($data,$le);
    else
    	return $this->fixLE(wordwrap($data, $chunk-2, $le, 1), $le);
  }
But there must be a better way to handle the situation...

All the best, end thanks for such a great work !

Posted: Thu Aug 09, 2007 1:45 pm
by Chris Corbyn
Turn line wrapping off:

Code: Select all

$message->setLineWrap(0);
If you have any MIME parts embedded you also need to run:

Code: Select all

$part->setLineWrap(0);

Posted: Fri Aug 10, 2007 5:44 am
by furax
d11wtq wrote:Turn line wrapping off:

Code: Select all

$message->setLineWrap(0);
Ahem... this puts one caracter per line in the mail, not quite what we want, do we :( ?

Could that be because the "cut" parameter of the wordwrap function is forced to 1 ?

Posted: Fri Aug 10, 2007 6:05 am
by furax
furax wrote:
d11wtq wrote:Turn line wrapping off:

Code: Select all

$message->setLineWrap(0);
Ahem... this puts one caracter per line in the mail, not quite what we want, do we :( ?

Could that be because the "cut" parameter of the wordwrap function is forced to 1 ?
No, found it !

It's because the $chunk-2 in the encoding function... so you need setLineWrap(2)...

But then, PHP throws an error because of the forced cut:
Can't force cut when width is zero
That being said, the result is still not satisfactory with the with at 0 and the cut unset as blank lines are added...