Package org.mozilla.jss.pkcs11
Class PK11Cert
java.lang.Object
java.security.cert.Certificate
java.security.cert.X509Certificate
org.mozilla.jss.pkcs11.PK11Cert
- All Implemented Interfaces:
Serializable,AutoCloseable,X509Extension,X509Certificate
- Direct Known Subclasses:
PK11InternalCert,PK11TokenCert
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA class that implements Principal with a String.Nested classes/interfaces inherited from class java.security.cert.Certificate
Certificate.CertificateRep -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.mozilla.jss.pkcs11.CertProxystatic org.slf4j.Loggerprotected Stringprotected TokenProxy -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcheckValidity(Date date) voidclose()booleanvoidfinalize()intbyte[]byte[]getExtensionValue(String oid) protected Stringboolean[]boolean[]protected CryptoTokenprotected byte[]byte[]byte[]protected Stringboolean[]byte[]protected intgetTrust(int type) Gets the trust flags for this cert.protected byte[]intinthashCode()booleanprotected voidsetTrust(int type, int trust) Sets the trust flags for this cert.toString()voidvoidMethods inherited from class java.security.cert.X509Certificate
getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerX500Principal, getSubjectAlternativeNames, getSubjectX500Principal, verifyMethods inherited from class java.security.cert.Certificate
getType, writeReplace
-
Field Details
-
logger
public static org.slf4j.Logger logger -
certProxy
protected org.mozilla.jss.pkcs11.CertProxy certProxy -
tokenProxy
-
nickname
-
-
Method Details
-
getEncoded
- Specified by:
getEncodedin interfaceX509Certificate- Specified by:
getEncodedin classCertificate- Returns:
- The DER encoding of this certificate.
- Throws:
CertificateEncodingException- If an error occurred.
-
getNickname
- Specified by:
getNicknamein interfaceX509Certificate- Returns:
- The nickname of this certificate (could be null).
-
hashCode
public int hashCode()- Overrides:
hashCodein classCertificate
-
equals
- Overrides:
equalsin classCertificate
-
getSubjectDN
- Specified by:
getSubjectDNin interfaceX509Certificate- Specified by:
getSubjectDNin classX509Certificate- Returns:
- The RFC 1485 ASCII encoding of the Subject Name.
-
getIssuerDN
- Specified by:
getIssuerDNin interfaceX509Certificate- Specified by:
getIssuerDNin classX509Certificate- Returns:
- The RFC 1485 ASCII encoding of the issuer's Subject Name.
-
getSerialNumber
- Specified by:
getSerialNumberin interfaceX509Certificate- Specified by:
getSerialNumberin classX509Certificate- Returns:
- The serial number of this certificate.
-
getSerialNumberByteArray
protected byte[] getSerialNumberByteArray() -
getSubjectDNString
-
getIssuerDNString
-
getPublicKey
- Specified by:
getPublicKeyin interfaceX509Certificate- Specified by:
getPublicKeyin classCertificate- Returns:
- The Public Key from this certificate.
-
getVersion
public int getVersion()- Specified by:
getVersionin interfaceX509Certificate- Specified by:
getVersionin classX509Certificate- Returns:
- the version number of this X.509 certificate. 0 means v1, 1 means v2, 2 means v3.
-
getBasicConstraints
public int getBasicConstraints()- Specified by:
getBasicConstraintsin classX509Certificate
-
getKeyUsage
public boolean[] getKeyUsage()- Specified by:
getKeyUsagein classX509Certificate
-
getSubjectUniqueID
public boolean[] getSubjectUniqueID()- Specified by:
getSubjectUniqueIDin classX509Certificate
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()- Specified by:
getIssuerUniqueIDin classX509Certificate
-
getSigAlgParams
public byte[] getSigAlgParams()- Specified by:
getSigAlgParamsin classX509Certificate
-
getSigAlgName
- Specified by:
getSigAlgNamein classX509Certificate
-
getSigAlgOID
- Specified by:
getSigAlgOIDin classX509Certificate
-
getSignature
public byte[] getSignature()- Specified by:
getSignaturein classX509Certificate
-
getTBSCertificate
- Specified by:
getTBSCertificatein classX509Certificate- Throws:
CertificateEncodingException
-
getNotAfter
- Specified by:
getNotAfterin classX509Certificate
-
getNotBefore
- Specified by:
getNotBeforein classX509Certificate
-
checkValidity
- Specified by:
checkValidityin classX509Certificate- Throws:
CertificateExpiredExceptionCertificateNotYetValidException
-
checkValidity
public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException - Specified by:
checkValidityin classX509Certificate- Throws:
CertificateExpiredExceptionCertificateNotYetValidException
-
toString
- Specified by:
toStringin classCertificate
-
verify
public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException - Specified by:
verifyin classCertificate- Throws:
CertificateExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionNoSuchProviderExceptionSignatureException
-
verify
public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException - Specified by:
verifyin classCertificate- Throws:
CertificateExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionNoSuchProviderExceptionSignatureException
-
getExtensionValue
- Specified by:
getExtensionValuein interfaceX509Extension
-
getCriticalExtensionOIDs
- Specified by:
getCriticalExtensionOIDsin interfaceX509Extension
-
getNonCriticalExtensionOIDs
- Specified by:
getNonCriticalExtensionOIDsin interfaceX509Extension
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()- Specified by:
hasUnsupportedCriticalExtensionin interfaceX509Extension
-
finalize
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
getUniqueID
protected byte[] getUniqueID() -
getOwningToken
-
setTrust
protected void setTrust(int type, int trust) Sets the trust flags for this cert.- Parameters:
type- SSL, EMAIL, or OBJECT_SIGNING.trust- The trust flags for this type of trust.
-
getTrust
protected int getTrust(int type) Gets the trust flags for this cert.- Parameters:
type- SSL, EMAIL, or OBJECT_SIGNING.- Returns:
- The trust flags for this type of trust.
-