Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.crmf;
  
 
 public class CertTemplateBuilder
 {
     private ASN1Integer version;
     private ASN1Integer serialNumber;
     private AlgorithmIdentifier signingAlg;
     private X500Name issuer;
     private OptionalValidity validity;
     private X500Name subject;
     private SubjectPublicKeyInfo publicKey;
     private DERBitString issuerUID;
     private DERBitString subjectUID;
     private Extensions extensions;

    
Sets the X.509 version. Note: for X509v3, use 2 here.
 
     public CertTemplateBuilder setVersion(int ver)
     {
          = new ASN1Integer(ver);
 
         return this;
     }
 
     {
          = ser;
 
         return this;
     }
 
     {
          = aid;
 
         return this;
     }
 
     public CertTemplateBuilder setIssuer(X500Name name)
     {
          = name;
 
         return this;
     }
 
     {
          = v;
 
         return this;
     }
 
     public CertTemplateBuilder setSubject(X500Name name)
     {
          = name;
 
         return this;
     }
 
     {
          = spki;
 
         return this;
     }

    
Sets the issuer unique ID (deprecated in X.509v3)
 
     {
          = uid;
 
         return this;
     }

    
Sets the subject unique ID (deprecated in X.509v3)
 
     {
          = uid;
 
         return this;
     }

    

Deprecated:
use method taking Extensions
Parameters:
extens
Returns:
 
    {
        return setExtensions(Extensions.getInstance(extens));
    }
    {
         = extens;
        return this;
    }

    
  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 }
 

Returns:
a basic ASN.1 object representation.
    public CertTemplate build()
    {
        ASN1EncodableVector v = new ASN1EncodableVector();
        addOptional(v, 0, false);
        addOptional(v, 1, false);
        addOptional(v, 2, false);
        addOptional(v, 3, true); // CHOICE
        addOptional(v, 4, false);
        addOptional(v, 5, true); // CHOICE
        addOptional(v, 6, false);
        addOptional(v, 7, false);
        addOptional(v, 8, false);
        addOptional(v, 9, false);
        return CertTemplate.getInstance(new DERSequence(v));
    }
    private void addOptional(ASN1EncodableVector vint tagNoboolean isExplicitASN1Encodable obj)
    {
        if (obj != null)
        {
            v.add(new DERTaggedObject(isExplicittagNoobj));
        }
    }
New to GrepCode? Check out our FAQ X