Exemple #1
0
        public Ticket Decode(Asn1Element element)
        {
            var childNode = element[0];

            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().Decode(node[0], Realm);
                    break;

                case 3:
                    EncPart = new EncryptedData().Decode(node);
                    break;
                }
            }

            return(this);
        }
Exemple #2
0
        public Authenticator Decode(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().Decode(node[0], Realm);
                    break;

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

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

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

                case 6:
                    SubSessionKey = new EncryptionKey().Decode(node[0]);
                    break;

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

                case 8:
                    var parent = node[0];

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

                        Authorizations.AddRange(azElements);
                    }
                    break;
                }
            }

            return(this);
        }
Exemple #3
0
        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, Realm);
                    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:
                    var parent = node[0];

                    for (var p = 0; p < parent.Count; p++)
                    {
                        Authorizations.Add(new AuthorizationData(parent[p]));
                    }
                    break;
                }
            }
        }
Exemple #4
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);
        }
        public EncTicketPart(Asn1Element asn1Element)
        {
            var childNode = asn1Element[0];

            if (childNode == null)
            {
                return;
            }

            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:
                    EncryptionKey = node[0][1][0].Value;
                    break;

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

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

                case 4:
                    for (int l = 0; l < node.Count; l++)
                    {
                        Transited.Add(new TransitedEncoding(new Asn1Element(node.Value)));
                    }
                    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:
                    AuthorizationData = new AuthorizationData(node[0]);
                    break;
                }
            }
        }