Пример #1
0
        public static void SaveProtectedString(string name, string value)
        {
            byte[] entropy = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };

            byte[] enc = ProtectedData.Protect(Encoding.Unicode.GetBytes(value), entropy, DataProtectionScope.LocalMachine);

            byte[] dec = ProtectedData.Unprotect(enc, entropy, DataProtectionScope.CurrentUser);

            DataPrefs.SaveByteArray(name + "_Protected", dec, Mode.Overwrite);

            using (StreamWriter sw = new StreamWriter(Application.dataPath + "/" + DataPrefs.FolderName + "/" + name + DataPrefs.FileType)) {
                sw.WriteLine(BitConverter.ToString(enc));
            }
        }
Пример #2
0
 public static byte[] ByteArray(string name, byte[] value, Mode m = 0)
 {
     DataPrefs.SaveByteArray(name, value, m);
     return(DataPrefs.LoadByteArray(name));
 }