Esempio n. 1
0
        /// <summary>
        /// Parse the binary ticket specified. The base 64 ticket field is not
        /// modified.
        /// </summary>
        public void FromBinaryTicket(byte[] binaryTicket)
        {
            BinaryTicket = binaryTicket;
            if (BinaryTicket.Length < 38)
            {
                throw new Exception("invalid ticket length");
            }
            int payloadLength = BinaryTicket[37];

            payloadLength |= (BinaryTicket[36] << 8);
            payloadLength |= (BinaryTicket[35] << 16);
            payloadLength |= (BinaryTicket[34] << 24);
            byte[] strippedTicket = new byte[payloadLength];
            for (int i = 0; i < payloadLength; i++)
            {
                strippedTicket[i] = BinaryTicket[i + 38];
            }

            AnpTicket          = new AnpMsg();
            AnpTicket.Elements = AnpMsg.ParsePayload(strippedTicket);
            UserName           = AnpTicket.Elements[0].String;
            EmailAddr          = AnpTicket.Elements[1].String;
            KcdAddr            = AnpTicket.Elements[2].String;
            KcdPort            = (UInt16)AnpTicket.Elements[3].UInt32;
            KpsKeyID           = AnpTicket.Elements[4].UInt64;
        }