From: Michael M Slusarz Date: Tue, 21 Dec 2010 21:50:50 +0000 (-0700) Subject: Bug #9426: Fix S/Mime signing X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6e30cda864a9971d1231cf38026dc5bd93713288;p=horde.git Bug #9426: Fix S/Mime signing Workaround broken openssl_pkcs7_sign() - it outputs both \r\n and \n in the same string. --- diff --git a/framework/Crypt/lib/Horde/Crypt/Smime.php b/framework/Crypt/lib/Horde/Crypt/Smime.php index caf5acc30..949975c09 100644 --- a/framework/Crypt/lib/Horde/Crypt/Smime.php +++ b/framework/Crypt/lib/Horde/Crypt/Smime.php @@ -391,7 +391,14 @@ class Horde_Crypt_Smime extends Horde_Crypt throw new Horde_Crypt_Exception(Horde_Crypt_Translation::t("Could not S/MIME sign message.")); } - $data = file_get_contents($output); + /* Output from openssl_pkcs7_sign may contain both \n and \r\n EOLs. + * Canonicalize to \r\n. */ + $fp = fopen($output, 'r'); + stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol'); + stream_filter_append($fp, 'horde_eol'); + $data = stream_get_contents($fp); + fclose($fp); + return $this->_fixContentType($data, 'signature'); } diff --git a/framework/Crypt/package.xml b/framework/Crypt/package.xml index 7956955d5..9956df661 100644 --- a/framework/Crypt/package.xml +++ b/framework/Crypt/package.xml @@ -361,6 +361,10 @@ pear.horde.org + Stream_Filter + pear.horde.org + + Translation pear.horde.org