public byte[] Decode(string encodedData, MachineKeyProtection protectionOption) { string optionString = protectionOption.ToString(); if (encodedData.StartsWith(optionString, StringComparison.Ordinal)) { encodedData = encodedData.Substring(optionString.Length + 1); } else { throw new Exception("Corrupted data."); } return(Convert.FromBase64String(encodedData)); }
public string Encode(byte[] data, MachineKeyProtection protectionOption) { return(protectionOption.ToString() + "-" + Convert.ToBase64String(data)); }
public string Encode(byte[] data, MachineKeyProtection protectionOption) { return protectionOption.ToString() + "-" + Convert.ToBase64String(data); }
public byte[] Decode(string encodedData, MachineKeyProtection protectionOption) { string optionString = protectionOption.ToString(); if (encodedData.StartsWith(optionString, StringComparison.Ordinal)) { encodedData = encodedData.Substring(optionString.Length + 1); } else { throw new Exception("Corrupted data."); } return Convert.FromBase64String(encodedData); }