コード例 #1
0
        public EncTicketPart(Asn1Element asn1Element)
        {
            var childNode = asn1Element[0];

            for (var i = 0; i < childNode.Count; i++)
            {
                var node = childNode[i];

                switch (node.ContextSpecificTag)
                {
                case 0:
                    TicketFlags = node[0].AsLong();
                    break;

                case 1:
                    EncryptionKey = node[0][1][0].Value;
                    break;

                case 2:
                    CRealm = node[0].AsString();
                    break;

                case 3:
                    CName = new PrincipalName(node);
                    break;

                case 4:
                    for (int l = 0; l < node.Count; l++)
                    {
                        var t = node[l];
                        Transited.Add(new TransitedEncoding(t));
                    }
                    break;

                case 5:
                    AuthTime = node[0].AsDateTimeOffset();
                    break;

                case 6:
                    StartTime = node[0].AsDateTimeOffset();
                    break;

                case 7:
                    EndTime = node[0].AsDateTimeOffset();
                    break;

                case 8:
                    RenewTill = node[0].AsDateTimeOffset();
                    break;

                case 9:
                    HostAddress = node[0].AsLong();
                    break;

                case 10:

                    var parent = node[0];

                    AuthorizationData = new AuthorizationData(parent);

                    break;
                }
            }
        }
コード例 #2
0
        public EncTicketPart Decode(Asn1Element asn1Element)
        {
            var childNode = asn1Element[0];

            if (childNode == null)
            {
                return(null);
            }

            for (var i = 0; i < childNode.Count; i++)
            {
                var node = childNode[i];

                switch (node.ContextSpecificTag)
                {
                case 0:
                    TicketFlags = (TicketFlags)node[0].AsLong();
                    break;

                case 1:
                    Key = new EncryptionKey().Decode(node[0]);
                    break;

                case 2:
                    CRealm = node[0].AsString();
                    break;

                case 3:
                    CName = new PrincipalName().Decode(node[0], CRealm);
                    break;

                case 4:
                    for (int l = 0; l < node.Count; l++)
                    {
                        Transited.Add(new TransitedEncoding().Decode(node[l]));
                    }
                    break;

                case 5:
                    AuthTime = node[0].AsDateTimeOffset();
                    break;

                case 6:
                    StartTime = node[0].AsDateTimeOffset();
                    break;

                case 7:
                    EndTime = node[0].AsDateTimeOffset();
                    break;

                case 8:
                    RenewTill = node[0].AsDateTimeOffset();
                    break;

                case 9:
                    HostAddresses = node[0].AsLong();
                    break;

                case 10:
                    var parent = node[0];

                    var authorizations = new List <AuthorizationData>();

                    for (var p = 0; p < parent.Count; p++)
                    {
                        var azElements = AuthorizationDataElement.ParseElements(parent[p]);

                        authorizations.AddRange(azElements);
                    }

                    AuthorizationData = authorizations;
                    break;
                }
            }

            return(this);
        }