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)); } }
public static void SetString(string key, string value) { PlayerPrefs.SetString(MD5Util.GetMD5(key), AESUtil.Encrypt(value, AESKey.DefaultKey, AESKey.DefaultIV)); }
public static string ReadAllText(string path, string key, string iv) { var text = File.ReadAllText(path); return(AESUtil.Decrypt(text, key, iv)); }
public static void WriteAllBytes(string path, byte[] bytes, string key, string iv) { var bs = AESUtil.Encrypt(bytes, key, iv); File.WriteAllBytes(path, bs); }
public static byte[] ReadAllBytes(string path, string key, string iv) { var text = File.ReadAllBytes(path); return(AESUtil.Decrypt(text, key, iv)); }
public static void WriteAllText(string path, string text, string key, string iv) { var bs = AESUtil.Encrypt(text, key, iv); File.WriteAllText(path, bs); }
/// <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)); }