DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Local Protect Data (bind To A Machine)
using System.Security.Cryptography;
private static readonly byte[] salt = new byte[] { 0x26, 0xdc, 0xff, 0x00, 0xad, 0xed, 0x7a, 0xee, 0xc5, 0xfe, 0x07, 0xaf, 0x4d, 0x08, 0x22, 0x3c };
public static byte[] ProtectLocalData(byte[] plain)
{
return ProtectedData.Protect(plain, salt, DataProtectionScope.LocalMachine);
}
public static byte[] UnprotectLocalData(byte[] cipher)
{
return ProtectedData.Unprotect(cipher, salt, DataProtectionScope.LocalMachine);
}





