CertTemplate (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.asn1.crmf

## Class CertTemplate

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.crmf.CertTemplate

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class CertTemplate
      extends ASN1Object

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Extensions` | `getExtensions()`
    `static CertTemplate` | `getInstance(java.lang.Object o)`
    `X500Name` | `getIssuer()`
    `ASN1BitString` | `getIssuerUID()`
    `SubjectPublicKeyInfo` | `getPublicKey()`
    `ASN1Integer` | `getSerialNumber()`
    `AlgorithmIdentifier` | `getSigningAlg()`
    `X500Name` | `getSubject()`
    `ASN1BitString` | `getSubjectUID()`
    `OptionalValidity` | `getValidity()`
    `int` | `getVersion()` Return Version - -1 if not set.
    `ASN1Primitive` | `toASN1Primitive()` 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 }

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static CertTemplate getInstance(java.lang.Object o)

    - #### getVersion

          public int getVersion()

      Return Version - -1 if not set.
      Returns:
        Version value.

    - #### getSerialNumber

          public ASN1Integer getSerialNumber()

    - #### getSigningAlg

          public AlgorithmIdentifier getSigningAlg()

    - #### getIssuer

          public X500Name getIssuer()

    - #### getValidity

          public OptionalValidity getValidity()

    - #### getSubject

          public X500Name getSubject()

    - #### getPublicKey

          public SubjectPublicKeyInfo getPublicKey()

    - #### getIssuerUID

          public ASN1BitString getIssuerUID()

    - #### getSubjectUID

          public ASN1BitString getSubjectUID()

    - #### getExtensions

          public Extensions getExtensions()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

            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 }

      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a basic ASN.1 object representation.