Пример #1
0
 public TstInfo(
     DerObjectIdentifier tsaPolicyId,
     MessageImprint messageImprint,
     DerInteger serialNumber,
     DerGeneralizedTime genTime,
     Accuracy accuracy,
     DerBoolean ordering,
     DerInteger nonce,
     GeneralName tsa,
     X509Extensions extensions)
 {
     this.version        = new DerInteger(1);
     this.tsaPolicyId    = tsaPolicyId;
     this.messageImprint = messageImprint;
     this.serialNumber   = serialNumber;
     this.genTime        = genTime;
     this.accuracy       = accuracy;
     this.ordering       = ordering;
     this.nonce          = nonce;
     this.tsa            = tsa;
     this.extensions     = extensions;
 }
Пример #2
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);
                }
            }
        }