public static byte[] LocalUnprotectData(byte[] data) { if (data == null) { return(null); } return(DataProtectionLocal.UnprotectData(data, 1)); }
public static byte[] LocalProtectData(byte[] data) { if (data == null) { return(null); } return(DataProtectionLocal.ProtectData(data, 1 | DataProtectionLocal.m_dwProtectionFlags)); }
public byte[] ProtectData(string unprotectedData, string tag) { if (unprotectedData == null) { return(null); } byte[] bytes = Encoding.Unicode.GetBytes(unprotectedData); return(DataProtectionLocal.LocalProtectData(bytes)); }
public static string LocalProtectData(string data) { if (data == null) { return(null); } byte[] bytes = Encoding.Unicode.GetBytes(data); byte[] array = DataProtectionLocal.LocalProtectData(bytes); string result = null; if (array != null) { result = Convert.ToBase64String(array); } return(result); }
public string UnprotectDataToString(byte[] protectedData, string tag) { if (protectedData == null) { return(null); } byte[] array = DataProtectionLocal.LocalUnprotectData(protectedData); if (array == null) { return(null); } if (protectedData.Length == 0) { return(string.Empty); } return(Encoding.Unicode.GetString(array)); }
public static string LocalUnprotectData(string data) { if (data == null) { return(null); } byte[] data2 = Convert.FromBase64String(data); byte[] array = DataProtectionLocal.LocalUnprotectData(data2); string text = null; if (array != null) { text = Encoding.Unicode.GetString(array); if (text != null && text.Length > 0 && text[text.Length - 1] == '\0') { text = text.Remove(text.Length - 1); } } return(text); }