Beispiel #1
0
        public PkiStatusInfo(
            Asn1Sequence seq)
        {
            this.status = DerInteger.GetInstance(seq[0]);

            this.statusString = null;
            this.failInfo     = null;

            if (seq.Count > 2)
            {
                this.statusString = PkiFreeText.GetInstance(seq[1]);
                this.failInfo     = DerBitString.GetInstance(seq[2]);
            }
            else if (seq.Count > 1)
            {
                object obj = seq[1];
                if (obj is DerBitString)
                {
                    this.failInfo = DerBitString.GetInstance(obj);
                }
                else
                {
                    this.statusString = PkiFreeText.GetInstance(obj);
                }
            }
        }
Beispiel #2
0
        private PollRepContent(Asn1Sequence seq)
        {
            certReqId  = DerInteger.GetInstance(seq[0]);
            checkAfter = DerInteger.GetInstance(seq[1]);

            if (seq.Count > 2)
            {
                reason = PkiFreeText.GetInstance(seq[2]);
            }
        }
Beispiel #3
0
        private PkiHeader(Asn1Sequence seq)
        {
            pvno      = DerInteger.GetInstance(seq[0]);
            sender    = GeneralName.GetInstance(seq[1]);
            recipient = GeneralName.GetInstance(seq[2]);

            for (int pos = 3; pos < seq.Count; ++pos)
            {
                Asn1TaggedObject tObj = (Asn1TaggedObject)seq[pos];

                switch (tObj.TagNo)
                {
                case 0:
                    messageTime = DerGeneralizedTime.GetInstance(tObj, true);
                    break;

                case 1:
                    protectionAlg = AlgorithmIdentifier.GetInstance(tObj, true);
                    break;

                case 2:
                    senderKID = Asn1OctetString.GetInstance(tObj, true);
                    break;

                case 3:
                    recipKID = Asn1OctetString.GetInstance(tObj, true);
                    break;

                case 4:
                    transactionID = Asn1OctetString.GetInstance(tObj, true);
                    break;

                case 5:
                    senderNonce = Asn1OctetString.GetInstance(tObj, true);
                    break;

                case 6:
                    recipNonce = Asn1OctetString.GetInstance(tObj, true);
                    break;

                case 7:
                    freeText = PkiFreeText.GetInstance(tObj, true);
                    break;

                case 8:
                    generalInfo = Asn1Sequence.GetInstance(tObj, true);
                    break;

                default:
                    throw new ArgumentException("unknown tag number: " + tObj.TagNo, "seq");
                }
            }
        }
Beispiel #4
0
        private ErrorMsgContent(Asn1Sequence seq)
        {
            pkiStatusInfo = PkiStatusInfo.GetInstance(seq[0]);

            for (int pos = 1; pos < seq.Count; ++pos)
            {
                Asn1Encodable ae = seq[pos];
                if (ae is DerInteger)
                {
                    errorCode = DerInteger.GetInstance(ae);
                }
                else
                {
                    errorDetails = PkiFreeText.GetInstance(ae);
                }
            }
        }