Class PTEID_Certificate

java.lang.Object
pt.gov.cartaodecidadao.PTEID_Object
pt.gov.cartaodecidadao.PTEID_Certificate

public class PTEID_Certificate extends PTEID_Object
Class that represents one certificate.
  • Field Details

    • CITIZEN_AUTH

      public static final long CITIZEN_AUTH
    • CITIZEN_SIGN

      public static final long CITIZEN_SIGN
    • SUB_CA_SIGN

      public static final long SUB_CA_SIGN
    • SUB_CA_AUTH

      public static final long SUB_CA_AUTH
  • Method Details

    • delete

      public void delete()
      Overrides:
      delete in class PTEID_Object
    • getLabel

      public String getLabel() throws PTEID_Exception
      Return the label of the certificate
      Throws:
      PTEID_Exception
    • getID

      public long getID() throws PTEID_Exception
      Return the id of the certificate
      Throws:
      PTEID_Exception
    • getType

      public PTEID_CertifType getType() throws PTEID_Exception
      Return the type of the certificate
      Throws:
      PTEID_Exception
    • getCertData

      public PTEID_ByteArray getCertData() throws PTEID_Exception
      Return the content of the certificate
      Throws:
      PTEID_Exception
    • getFormattedData

      public void getFormattedData(PTEID_ByteArray data)
      Return the content of the certificate without padding zeros
    • getSerialNumber

      public String getSerialNumber() throws PTEID_Exception
      Return the serial number of the certificate
      Throws:
      PTEID_Exception
    • getOwnerName

      public String getOwnerName() throws PTEID_Exception
      Return the name of the owner of the certificate
      Throws:
      PTEID_Exception
    • getSubjectSerialNumber

      public String getSubjectSerialNumber()
      Return the serial number of the subject of the certificate
    • getIssuerName

      public String getIssuerName() throws PTEID_Exception
      Return the name of the issuer of the certificate
      Throws:
      PTEID_Exception
    • getValidityBegin

      public String getValidityBegin() throws PTEID_Exception
      Return the validity begin date of the certificate
      Throws:
      PTEID_Exception
    • getValidityEnd

      public String getValidityEnd() throws PTEID_Exception
      Return the validity end date of the certificate
      Throws:
      PTEID_Exception
    • getKeyLength

      public long getKeyLength() throws PTEID_Exception
      Return the length of public/private key on the certificate
      Throws:
      PTEID_Exception
    • getStatus

      public PTEID_CertifStatus getStatus()
      Return OCSP/CRL validation status
    • getStatus

      public PTEID_CertifStatus getStatus(boolean useCache, boolean validateChain)
      OCSP/CRL validation status

      Parameters:
      useCache - boolean that specifies if cached certificates can be utilized for the validation (default true)
      validateChain - boolean that specifies if the entire certificate chain is to be validated or not (default
      true)
    • isRoot

      public boolean isRoot() throws PTEID_Exception
      Return true if this is a root certificate.
      Throws:
      PTEID_Exception
    • isTest

      public boolean isTest()
      Return the test status.

      Returns:
      true if test certificate
    • isFromPteidValidChain

      public boolean isFromPteidValidChain() throws PTEID_Exception
      Return true if the certificate chain end by the one of pteid root.
      Throws:
      PTEID_Exception
    • isFromCard

      public boolean isFromCard() throws PTEID_Exception
      This certificate comes from the card.
      Throws:
      PTEID_Exception
    • verifyDateValidity

      public boolean verifyDateValidity()
      Return true if the current time is between the certificate's notBefore and notAfter
    • getIssuer

      public PTEID_Certificate getIssuer() throws PTEID_Exception
      Return the issuer certificate.

      if there is no issuer (root), PTEID_ExCertNoIssuer exception is thrown
      Throws:
      PTEID_Exception
    • countChildren

      public long countChildren() throws PTEID_Exception
      Return the number of children for this certificate.
      Throws:
      PTEID_Exception
    • getChildren

      public PTEID_Certificate getChildren(long ulIndex) throws PTEID_Exception
      Return the children certificate (certificate that has been issued by this one).

      Parameters:
      ulIndex - is the children index (the index for the first child is 0)
      Throw PTEID_ExParamRange exception if the index is out of range
      Throws:
      PTEID_Exception