note 67099 deleted from ref.mcrypt by bjori

From: Date: Sat, 03 Jun 2006 08:20:13 +0000
Subject: note 67099 deleted from ref.mcrypt by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-113077@lists.php.net to get a copy of this message
Note Submitter: chris at forthelose dot net ---- 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.

« previous php.notes (#113077) next »