static public AuthenticationInfo Decode(string authenticationCookie) { byte[] data = Convert.FromBase64String(authenticationCookie); RC4.Transform(data); using (var stream = new MemoryStream(data)) { var ai = new AuthenticationInfo(); ai.ReadFromStream(stream); return(ai); } }
static public string Encode(AuthenticationInfo ai) { using (var stream = new MemoryStream()) { ai.WriteToStream(stream); var data = stream.ToArray(); RC4.Transform(data); string sEncoded = Convert.ToBase64String(data); return(sEncoded); } }