Exemple #1
0
 protected void InitServerContext(Cryptography.Authentication AuthenticationIn)
 {
     Authentication = AuthenticationIn;
     MasterSeed = new Cryptography.Key (Authentication);
 }
Exemple #2
0
        protected int Unpack()
        {
            int index = 0;
            byte x;

            x = Ticket [index++];
            if (x != 0) throw new Exception ("Bad ticket");
            x = Ticket [index++]; // ignore, checked already
            Authentication = (Cryptography.Authentication) Ticket [index++];
            Encryption = (Cryptography.Encryption) Ticket [index++];

            byte [] MasterKeyData = new byte [MasterKeyBytes];
            for (int i = 0; i < MasterKeyBytes; i++) {
                MasterKeyData [i] = Ticket [index++];
                }
            MasterKey = new Cryptography.Key (MasterKeyData, Authentication, Encryption);

            x = Ticket [index++];
            byte [] AccountIDData = new byte [x];
            int At = x; // No @ in string would mean it is all account, no domain
            for (int i = 0; i < x; i++) {
                if (Ticket[index] == '@') {
                    At = i;
                    }
                AccountIDData [i] = Ticket [index++];
                }
            Account = UTF8Encoding.GetString (AccountIDData, 0, At);
            Account = UTF8Encoding.GetString (AccountIDData, At-1, x-At-1);

            return index;
        }