Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Local Protect Data (bind To A Machine)

DZone's Guide to

Local Protect Data (bind To A Machine)

·
Free Resource

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);
        } 
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}