Пример #1
0
        private CertTemplate(Asn1Sequence seq)
        {
            this.seq = seq;

            foreach (Asn1TaggedObject tObj in seq)
            {
                switch (tObj.TagNo)
                {
                case 0:
                    version = DerInteger.GetInstance(tObj, false);
                    break;

                case 1:
                    serialNumber = DerInteger.GetInstance(tObj, false);
                    break;

                case 2:
                    signingAlg = AlgorithmIdentifier.GetInstance(tObj, false);
                    break;

                case 3:
                    issuer = X509Name.GetInstance(tObj, true); // CHOICE
                    break;

                case 4:
                    validity = OptionalValidity.GetInstance(Asn1Sequence.GetInstance(tObj, false));
                    break;

                case 5:
                    subject = X509Name.GetInstance(tObj, true); // CHOICE
                    break;

                case 6:
                    publicKey = SubjectPublicKeyInfo.GetInstance(tObj, false);
                    break;

                case 7:
                    issuerUID = DerBitString.GetInstance(tObj, false);
                    break;

                case 8:
                    subjectUID = DerBitString.GetInstance(tObj, false);
                    break;

                case 9:
                    extensions = X509Extensions.GetInstance(tObj, false);
                    break;

                default:
                    throw new ArgumentException("unknown tag: " + tObj.TagNo, "seq");
                }
            }
        }
Пример #2
0
 public virtual CertTemplateBuilder SetValidity(OptionalValidity v)
 {
     validity = v;
     return(this);
 }