0) { $mcrypt_iv = substr($encryptedData, 0, $iv_length); $encryptedData = substr($encryptedData, $iv_length); } $decrypted = mcrypt_decrypt(self::MCRYPT_CIPHER, $decryptionKey, $encryptedData, self::MCRYPT_MODE, $mcrypt_iv); if(!$decrypted) { throw new Zend_InfoCard_Cipher_Exception("Failed to decrypt data using AES256CBC Algorithm"); } $decryptedLength = strlen($decrypted); $paddingLength = substr($decrypted, $decryptedLength -1, 1); $decrypted = substr($decrypted, 0, $decryptedLength - ord($paddingLength)); return rtrim($decrypted, "\0"); } }