Class CertificateInfo

java.lang.Object
org.mozilla.jss.pkix.cert.CertificateInfo
All Implemented Interfaces:
ASN1Value

public class CertificateInfo extends Object implements ASN1Value
A TBSCertificate (to-be-signed certificate), the actual information in a certificate apart from the signature.
  • Field Details

  • Constructor Details

  • Method Details

    • setVersion

      public void setVersion(CertificateInfo.Version version)
    • getVersion

      public CertificateInfo.Version getVersion()
    • setSerialNumber

      public void setSerialNumber(INTEGER serialNumber)
    • getSerialNumber

      public INTEGER getSerialNumber()
    • setSignatureAlgId

      public void setSignatureAlgId(AlgorithmIdentifier signatureAlgId)
    • getSignatureAlgId

      public AlgorithmIdentifier getSignatureAlgId()
    • setIssuer

      public void setIssuer(Name issuer)
    • getIssuer

      public Name getIssuer()
    • setNotBefore

      public void setNotBefore(Date notBefore)
    • getNotBefore

      public Date getNotBefore()
    • setNotAfter

      public void setNotAfter(Date notAfter)
    • getNotAfter

      public Date getNotAfter()
    • setSubject

      public void setSubject(Name subject)
    • getSubject

      public Name getSubject()
    • setSubjectPublicKeyInfo

      public void setSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo)
    • setSubjectPublicKeyInfo

      public void setSubjectPublicKeyInfo(PublicKey pubk) throws InvalidBERException, IOException
      Extracts the SubjectPublicKeyInfo from the given public key and stores it in the CertificateInfo.
      Throws:
      InvalidBERException - If an error occurs decoding the the information extracted from the public key.
      IOException
    • getSubjectPublicKeyInfo

      public SubjectPublicKeyInfo getSubjectPublicKeyInfo()
    • setIssuerUniqueIdentifier

      public void setIssuerUniqueIdentifier(BIT_STRING issuerUniqueIdentifier) throws CertificateException
      Throws:
      CertificateException - If the certificate is a v1 certificate.
    • hasIssuerUniqueIdentifier

      public boolean hasIssuerUniqueIdentifier()
    • getIssuerUniqueIdentifier

      public BIT_STRING getIssuerUniqueIdentifier()
      Should only be called if this field is present.
    • setSubjectUniqueIdentifier

      public void setSubjectUniqueIdentifier(BIT_STRING subjectUniqueIdentifier) throws CertificateException
      Throws:
      CertificateException - If the certificate is a v1 certificate.
    • hasSubjectUniqueIdentifier

      public boolean hasSubjectUniqueIdentifier()
    • getSubjectUniqueIdentifier

      public BIT_STRING getSubjectUniqueIdentifier()
    • hasExtensions

      public boolean hasExtensions()
    • getExtensions

      public SEQUENCE getExtensions()
      Returns the extensions of this certificate. The sequence may be empty, but this method will never return null.
    • isExtensionPresent

      public boolean isExtensionPresent(OBJECT_IDENTIFIER oid)
      Linearly searches the extension list for an extension with the given object identifier. If it finds one, returns true. Otherwise, returns false.
    • getExtension

      public Extension getExtension(OBJECT_IDENTIFIER oid)
      Linearly searches the extension list for an extension with the given object identifier. It returns the first one it finds. If none are found, returns null.
    • setExtensions

      public void setExtensions(SEQUENCE extensions) throws CertificateException
      Throws:
      CertificateException - If the certificate is not a v3 certificate.
    • addExtension

      public void addExtension(Extension extension) throws CertificateException
      Throws:
      CertificateException - If the certificate is not a v3 certificate.
    • verifyNotNull

      private void verifyNotNull(Object obj)
    • getTag

      public Tag getTag()
      Description copied from interface: ASN1Value
      Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
      Specified by:
      getTag in interface ASN1Value
      Returns:
      Base tag.
    • encode

      public void encode(OutputStream ostream) throws IOException
      Description copied from interface: ASN1Value
      Write this value's DER encoding to an output stream using its own base tag.
      Specified by:
      encode in interface ASN1Value
      Parameters:
      ostream - Output stream.
      Throws:
      IOException - If an error occurred.
    • encode

      public void encode(Tag implicitTag, OutputStream ostream) throws IOException
      Description copied from interface: ASN1Value
      Write this value's DER encoding to an output stream using an implicit tag.
      Specified by:
      encode in interface ASN1Value
      Parameters:
      implicitTag - Implicit tag.
      ostream - Output stream.
      Throws:
      IOException - If an error occurred.
    • encodeValidityDate

      private static ASN1Value encodeValidityDate(Date d)
      Returns the correct ASN1Value (UTCTime or GeneralizedTime) to represent the given certificate validity date.
    • getTemplate

      public static CertificateInfo.Template getTemplate()
    • print

      public void print(PrintStream ps) throws InvalidBERException
      Throws:
      InvalidBERException