Provides a way to encrypt or hash data (or both) by using the same algorithms and key values that are used for ASP.NET forms authentication and view state.
Assembly: System.Web (in System.Web.dll)
Thetype exposes the following members.
The data to encrypt, hash, decrypt, or validate does not exist
The class provides methods that expose the hashing and encryption logic that ASP.NET provides. For information about which encryption and hashing algorithms ASP.NET uses, and the key values that it uses with them, see machineKey Element (ASP.NET Settings Schema).
The following example shows how to encrypt, hash, decrypt, and validate a string. The code accepts a string that you enter, encrypts the data and adds a hash value to it using one call to the Encode(Byte, MachineKeyProtection) method, and then displays the encrypted data. The code then decrypts and validates the encrypted data in one call to the Decode(String, MachineKeyProtection) method, and displays the decrypted data in another label. The Encode(Byte, MachineKeyProtection) and Decode(String, MachineKeyProtection) methods accept a parameter that specifies whether they should encrypt or decrypt, hash or validate, or do both. In this example they do both.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.