Пример #1
0
        private static void BuildTicket(Ticket ticket, Asn1Node asn1Node)
        {
            Asn1Node childNode1 = asn1Node.GetChildNode(0).GetChildNode(0);

            for (int index = 0; (long)index < childNode1.ChildNodeCount; ++index)
            {
                Asn1Node childNode2 = childNode1.GetChildNode(index);
                switch (KerberosAuthorizeMessageBuilder.GetContextNumber(childNode2))
                {
                case 0:
                    ticket.TicketVersionNumber = (int)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data);
                    break;

                case 1:
                    ticket.Realm = childNode2.GetChildNode(0).GetDataStr(false);
                    break;

                case 2:
                    ticket.ServiceName = new PrincipalName();
                    KerberosAuthorizeMessageBuilder.BuildPrincipleName(ticket.ServiceName, childNode2);
                    break;

                case 3:
                    ticket.EncPart = new EncryptedData();
                    KerberosAuthorizeMessageBuilder.BuildEncryptedData(ticket.EncPart, childNode2);
                    break;
                }
            }
        }
Пример #2
0
        private static void BuildKrbApReq(KrbApReq krbApReq, Asn1Node asn1Node)
        {
            Asn1Node childNode1 = asn1Node.GetChildNode(0);

            for (int index = 0; (long)index < childNode1.ChildNodeCount; ++index)
            {
                Asn1Node childNode2 = childNode1.GetChildNode(index);
                switch (KerberosAuthorizeMessageBuilder.GetContextNumber(childNode2))
                {
                case 0:
                    krbApReq.ProtocolVersionNumber = (int)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data);
                    break;

                case 1:
                    krbApReq.MessageType = (MessageType)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data);
                    break;

                case 2:
                    krbApReq.APOptions = (APOptions)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data);
                    break;

                case 3:
                    krbApReq.Ticket = new Ticket();
                    KerberosAuthorizeMessageBuilder.BuildTicket(krbApReq.Ticket, childNode2);
                    break;

                case 4:
                    krbApReq.Authenticator = new EncryptedData();
                    KerberosAuthorizeMessageBuilder.BuildEncryptedData(krbApReq.Authenticator, childNode2);
                    break;
                }
            }
        }
Пример #3
0
        private static void BuildNegotiateTokenInit(NegTokenInit negToken, Asn1Node sequence)
        {
            for (int index = 0; (long)index < sequence.ChildNodeCount; ++index)
            {
                switch (KerberosAuthorizeMessageBuilder.GetContextNumber(sequence.GetChildNode(index)))
                {
                case 0:
                    KerberosAuthorizeMessageBuilder.BuildMechTypes(negToken, sequence.GetChildNode(index));
                    break;

                case 2:
                    negToken.MechToken = new InitialContextToken();
                    KerberosAuthorizeMessageBuilder.BuildMechToken(negToken.MechToken, sequence.GetChildNode(index));
                    break;
                }
            }
        }
Пример #4
0
        private static void BuildPrincipleName(PrincipalName principalName, Asn1Node asn1Node)
        {
            Asn1Node childNode1 = asn1Node.GetChildNode(0);

            for (int index = 0; (long)index < childNode1.ChildNodeCount; ++index)
            {
                Asn1Node childNode2 = childNode1.GetChildNode(index);
                switch (KerberosAuthorizeMessageBuilder.GetContextNumber(childNode2))
                {
                case 0:
                    principalName.NameType = (PrincipalNameType)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data);
                    break;

                case 1:
                    principalName.NameString = new List <string>();
                    KerberosAuthorizeMessageBuilder.BuildPrincipleNameList(principalName.NameString, childNode2);
                    break;
                }
            }
        }
Пример #5
0
        private static void BuildEncryptedData(EncryptedData encryptedData, Asn1Node asn1Node)
        {
            Asn1Node childNode1 = asn1Node.GetChildNode(0);

            for (int index = 0; (long)index < childNode1.ChildNodeCount; ++index)
            {
                Asn1Node childNode2 = childNode1.GetChildNode(index);
                switch (KerberosAuthorizeMessageBuilder.GetContextNumber(childNode2))
                {
                case 0:
                    encryptedData.EncryptionType = (EncryptionType)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data);
                    break;

                case 1:
                    encryptedData.KeyVersionNumber = new uint?((uint)Asn1Util.BytesToLong(childNode2.GetChildNode(0).Data));
                    break;

                case 2:
                    encryptedData.Cipher = new byte[childNode2.GetChildNode(0).DataLength];
                    Buffer.BlockCopy((Array)childNode2.GetChildNode(0).Data, 0, (Array)encryptedData.Cipher, 0, encryptedData.Cipher.Length);
                    break;
                }
            }
        }