Package pt.gov.cartaodecidadao
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 Summary
Fields Modifier and Type Field Description static longCITIZEN_AUTHstatic longCITIZEN_SIGNstatic longSUB_CA_AUTHstatic longSUB_CA_SIGN
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcountChildren()Return the number of children for this certificate.voiddelete()PTEID_ByteArraygetCertData()Return the content of the certificatePTEID_CertificategetChildren(long ulIndex)Return the children certificate (certificate that has been issued by this one).
voidgetFormattedData(PTEID_ByteArray data)Return the content of the certificate without ending zerolonggetID()Return the id of the certificatePTEID_CertificategetIssuer()Return the issuer certificate.
if there is no issuer (root), PTEID_ExCertNoIssuer exception is thrownjava.lang.StringgetIssuerName()Return the name of the issuer of the certificatelonggetKeyLength()Return the length of public/private key on the certificatejava.lang.StringgetLabel()Return the label of the certificatejava.lang.StringgetOwnerName()Return the name of the owner of the certificatejava.lang.StringgetSerialNumber()Return the serial number of the certificatePTEID_CertifStatusgetStatus()Return OCSP/CRL validation statusPTEID_CertifStatusgetStatus(boolean useCache, boolean validateChain)OCSP/CRL validation status
java.lang.StringgetSubjectSerialNumber()Return the serial number of the subject of the certificatePTEID_CertifTypegetType()Return the type of the certificatejava.lang.StringgetValidityBegin()Return the validity begin date of the certificatejava.lang.StringgetValidityEnd()Return the validity end date of the certificatebooleanisFromCard()This certificate comes from the card.booleanisFromPteidValidChain()Return true if the certificate chain end by the one of pteid root.booleanisRoot()Return true if this is a root certificate.booleanisTest()Return the test status.
booleanverifyDateValidity()Return true if the current time is between the certificate's notBefore and notAfter
-
-
-
Method Detail
-
delete
public void delete()
- Overrides:
deletein classPTEID_Object
-
getLabel
public java.lang.String getLabel() throws PTEID_ExceptionReturn the label of the certificate- Throws:
PTEID_Exception
-
getID
public long getID() throws PTEID_ExceptionReturn 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 ending zero
-
getSerialNumber
public java.lang.String getSerialNumber() throws PTEID_ExceptionReturn the serial number of the certificate- Throws:
PTEID_Exception
-
getOwnerName
public java.lang.String getOwnerName() throws PTEID_ExceptionReturn the name of the owner of the certificate- Throws:
PTEID_Exception
-
getSubjectSerialNumber
public java.lang.String getSubjectSerialNumber()
Return the serial number of the subject of the certificate
-
getIssuerName
public java.lang.String getIssuerName() throws PTEID_ExceptionReturn the name of the issuer of the certificate- Throws:
PTEID_Exception
-
getValidityBegin
public java.lang.String getValidityBegin() throws PTEID_ExceptionReturn the validity begin date of the certificate- Throws:
PTEID_Exception
-
getValidityEnd
public java.lang.String getValidityEnd() throws PTEID_ExceptionReturn the validity end date of the certificate- Throws:
PTEID_Exception
-
getKeyLength
public long getKeyLength() throws PTEID_ExceptionReturn 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_ExceptionReturn 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_ExceptionReturn true if the certificate chain end by the one of pteid root.- Throws:
PTEID_Exception
-
isFromCard
public boolean isFromCard() throws PTEID_ExceptionThis 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_ExceptionReturn 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
-
-