Esempio n. 1
0
        public Ticket(Asn1Element element)
        {
            var childNode = element[0][0];

            Asn1Value = childNode.Value;

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

                switch (node.ContextSpecificTag)
                {
                case 0:
                    TicketVersionNumber = node[0].AsInt();
                    break;

                case 1:
                    Realm = node[0].AsString();
                    break;

                case 2:
                    SName = new PrincipalName(node);
                    break;

                case 3:
                    EncPart = new EncryptedData(node);
                    break;
                }
            }
        }
        public Authenticator(Asn1Element asn1Element)
        {
            Asn1Element childNode = asn1Element[0];

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

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

                case 1:
                    Realm = node[0].AsString();
                    break;

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

                case 3:
                    Checksum = node[0].Value;
                    break;

                case 4:
                    CuSec = node[0].AsLong();
                    break;

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

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

                case 7:
                    SequenceNumber = node[0].AsLong();
                    break;

                case 8:     // this is not right. its ASN.1 plus vendor-specific data
                    var parent = node[0];

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

                        Authorizations.Add(new AuthorizationData(parent));
                    }
                    break;
                }
            }
        }
        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;
                }
            }
        }