예제 #1
0
 private CertRequest(Asn1Sequence seq)
 {
     certReqId    = DerInteger.GetInstance(seq[0]);
     certTemplate = CertTemplate.GetInstance(seq[1]);
     if (seq.Count > 2)
     {
         controls = Controls.GetInstance(seq[2]);
     }
 }
예제 #2
0
        /**
         * <pre>
         *  CertTemplate ::= SEQUENCE {
         *      version      [0] Version               OPTIONAL,
         *      serialNumber [1] INTEGER               OPTIONAL,
         *      signingAlg   [2] AlgorithmIdentifier   OPTIONAL,
         *      issuer       [3] Name                  OPTIONAL,
         *      validity     [4] OptionalValidity      OPTIONAL,
         *      subject      [5] Name                  OPTIONAL,
         *      publicKey    [6] SubjectPublicKeyInfo  OPTIONAL,
         *      issuerUID    [7] UniqueIdentifier      OPTIONAL,
         *      subjectUID   [8] UniqueIdentifier      OPTIONAL,
         *      extensions   [9] Extensions            OPTIONAL }
         * </pre>
         * @return a basic ASN.1 object representation.
         */
        public virtual CertTemplate Build()
        {
            Asn1EncodableVector v = new Asn1EncodableVector();

            AddOptional(v, 0, false, version);
            AddOptional(v, 1, false, serialNumber);
            AddOptional(v, 2, false, signingAlg);
            AddOptional(v, 3, true, issuer);  // CHOICE
            AddOptional(v, 4, false, validity);
            AddOptional(v, 5, true, subject); // CHOICE
            AddOptional(v, 6, false, publicKey);
            AddOptional(v, 7, false, issuerUID);
            AddOptional(v, 8, false, subjectUID);
            AddOptional(v, 9, false, extensions);

            return(CertTemplate.GetInstance(new DerSequence(v)));
        }