Ejemplo n.º 1
0
        private TstInfo(
            Asn1Sequence seq)
        {
            IEnumerator e = seq.GetEnumerator();

            // version
            e.MoveNext();
            version = DerInteger.GetInstance(e.Current);

            // tsaPolicy
            e.MoveNext();
            tsaPolicyId = DerObjectIdentifier.GetInstance(e.Current);

            // messageImprint
            e.MoveNext();
            messageImprint = MessageImprint.GetInstance(e.Current);

            // serialNumber
            e.MoveNext();
            serialNumber = DerInteger.GetInstance(e.Current);

            // genTime
            e.MoveNext();
            genTime = DerGeneralizedTime.GetInstance(e.Current);

            // default for ordering
            ordering = DerBoolean.False;

            while (e.MoveNext())
            {
                Asn1Object o = (Asn1Object)e.Current;

                if (o is Asn1TaggedObject)
                {
                    DerTaggedObject tagged = (DerTaggedObject)o;

                    switch (tagged.TagNo)
                    {
                    case 0:
                        tsa = GeneralName.GetInstance(tagged, true);
                        break;

                    case 1:
                        extensions = X509Extensions.GetInstance(tagged, false);
                        break;

                    default:
                        throw new ArgumentException("Unknown tag value " + tagged.TagNo);
                    }
                }

                if (o is DerSequence)
                {
                    accuracy = Accuracy.GetInstance(o);
                }

                if (o is DerBoolean)
                {
                    ordering = DerBoolean.GetInstance(o);
                }

                if (o is DerInteger)
                {
                    nonce = DerInteger.GetInstance(o);
                }
            }
        }