note 67099 added to ref.mcrypt

From: Date: Sat, 03 Jun 2006 06:02:17 +0000
Subject: note 67099 added to ref.mcrypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-113074@lists.php.net to get a copy of this message
If you're having issues with .NET and Mcrypt encrypting things under CBC, Mcrypt is the reason why. Mcrypt pads to match the block size using null bytes, whereas .NET is defaulted to use PKCS7. To fix this in .NET, you must set the padding mode of the cipher to Zeros, by doing the following: Let "cipher" be instance of System.Security.Cryptography.SymmetricAlgorithm cipher.Padding = PaddingMode.Zeros This was tested only under Rijndael, but it seems this will be true for any subclass of SymmetricAlgorithm. Hopefully this will stop some confusion I and a fellow programmer had, as the .NET engine throws a CryptographicException. Hope this helps. ---- Server IP: 216.194.113.175 Probable Submitter: 24.28.165.79 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.mcrypt.php Edit -- http://master.php.net/note/edit/67099 Del: integrated -- http://master.php.net/note/delete/67099/integrated Del: useless -- http://master.php.net/note/delete/67099/useless Del: bad code -- http://master.php.net/note/delete/67099/bad+code Del: spam -- http://master.php.net/note/delete/67099/spam Del: non-english -- http://master.php.net/note/delete/67099/non-english Del: in docs -- http://master.php.net/note/delete/67099/in+docs Del: other reasons-- http://master.php.net/note/delete/67099 Reject -- http://master.php.net/note/reject/67099 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#113074) next »