note 34611 added to function.mcrypt-module-open

From: Date: Fri, 01 Aug 2003 01:14:51 +0000
Subject: note 34611 added to function.mcrypt-module-open
Groups: php.notes 
Request: Send a blank email to php-notes+get-53125@lists.php.net to get a copy of this message
Doing a trim($decrypted) will remove the null padding that may occur as a result of decryption. The problem is if you're encrypting something like a MSWord document which can commonly end with nulls. The result $decrypted will be smaller than the original cleartext - which will then fail to open in MSOffice. To get around this, make sure you store the length of the original cleartext, and when you decrypt it, do: $decrypted = substr(mdecrypt_generic($td, $encrypted), 0, $originalLength); ---- Manual Page -- http://www.php.net/manual/en/function.mcrypt-module-open.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34611 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34611&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34611&report=yes

« previous php.notes (#53125) next »