Esempio n. 1
0
        public static string GetString(string key, string opt = default(string))
        {
            var ret = PlayerPrefs.GetString(MD5Util.GetMD5(key));

            if (string.IsNullOrEmpty(ret))
            {
                return(opt);
            }
            else
            {
                return(AESUtil.Decrypt(ret, AESKey.DefaultKey, AESKey.DefaultIV));
            }
        }
Esempio n. 2
0
 public static void SetString(string key, string value)
 {
     PlayerPrefs.SetString(MD5Util.GetMD5(key), AESUtil.Encrypt(value, AESKey.DefaultKey, AESKey.DefaultIV));
 }
Esempio n. 3
0
        public static string ReadAllText(string path, string key, string iv)
        {
            var text = File.ReadAllText(path);

            return(AESUtil.Decrypt(text, key, iv));
        }
Esempio n. 4
0
        public static void WriteAllBytes(string path, byte[] bytes, string key, string iv)
        {
            var bs = AESUtil.Encrypt(bytes, key, iv);

            File.WriteAllBytes(path, bs);
        }
Esempio n. 5
0
        public static byte[] ReadAllBytes(string path, string key, string iv)
        {
            var text = File.ReadAllBytes(path);

            return(AESUtil.Decrypt(text, key, iv));
        }
Esempio n. 6
0
        public static void WriteAllText(string path, string text, string key, string iv)
        {
            var bs = AESUtil.Encrypt(text, key, iv);

            File.WriteAllText(path, bs);
        }
Esempio n. 7
0
 /// <summary>
 /// 向表单中添加一条字段,字段的key和value将通过AES默认密钥加密
 /// </summary>
 /// <param name="wwwForm"></param>
 /// <param name="field"></param>
 /// <param name="value"></param>
 public static void AddFieldAESAll(this WWWForm wwwForm, string field, string value)
 {
     wwwForm.AddField(AESUtil.Encrypt(field, AESKey.DefaultKey, AESKey.DefaultIV), AESUtil.Encrypt(value, AESKey.DefaultKey, AESKey.DefaultIV));
 }