Package org.mozilla.jss.crypto
Class X509Certificate
java.lang.Object
java.security.cert.Certificate
java.security.cert.X509Certificate
org.mozilla.jss.crypto.X509Certificate
- All Implemented Interfaces:
Serializable
,X509Extension
,InternalCertificate
,TokenCertificate
- Direct Known Subclasses:
PK11Cert
public abstract class X509Certificate
extends X509Certificate
implements InternalCertificate, TokenCertificate
Certificates handled by JSS. All certificates handled by JSS are
of this type.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.security.cert.Certificate
Certificate.CertificateRep
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
decodeTrustFlags
(String flags) static String
encodeTrustFlags
(int flags) int
Get the email (S/MIME) trust flags for this certificate.abstract byte[]
abstract Principal
abstract String
int
Get the object signing trust flags for this certificate.abstract PublicKey
abstract BigInteger
int
Get the SSL trust flags for this certificate.abstract Principal
abstract int
getTrust
(int type) Gets the trust flags for this cert.abstract int
static boolean
isTrustFlagEnabled
(int flag, int flags) void
setEmailTrust
(int trust) Set the email (S/MIME) trust flags for this certificate.void
setObjectSigningTrust
(int trust) Set the object signing trust flags for this certificate.void
setSSLTrust
(int trust) Set the SSL trust flags for this certificate.abstract void
setTrust
(int type, int trust) Sets the trust flags for this cert.void
setTrustFlags
(String trustFlags) Methods inherited from class java.security.cert.X509Certificate
checkValidity, checkValidity, getBasicConstraints, getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerUniqueID, getIssuerX500Principal, getKeyUsage, getNotAfter, getNotBefore, getSigAlgName, getSigAlgOID, getSigAlgParams, getSignature, getSubjectAlternativeNames, getSubjectUniqueID, getSubjectX500Principal, getTBSCertificate, verify
Methods inherited from class java.security.cert.Certificate
equals, getType, hashCode, toString, verify, verify, writeReplace
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.mozilla.jss.crypto.TokenCertificate
getOwningToken, getUniqueID
Methods inherited from interface java.security.cert.X509Extension
getCriticalExtensionOIDs, getExtensionValue, getNonCriticalExtensionOIDs, hasUnsupportedCriticalExtension
-
Field Details
-
VALID_PEER
public static final int VALID_PEER- See Also:
-
TRUSTED_PEER
public static final int TRUSTED_PEER- See Also:
-
SEND_WARN
public static final int SEND_WARN- See Also:
-
VALID_CA
public static final int VALID_CA- See Also:
-
TRUSTED_CA
public static final int TRUSTED_CA- See Also:
-
NS_TRUSTED_CA
public static final int NS_TRUSTED_CA- See Also:
-
USER
public static final int USER- See Also:
-
TRUSTED_CLIENT_CA
public static final int TRUSTED_CLIENT_CA- See Also:
-
INVISIBLE_CA
public static final int INVISIBLE_CA- See Also:
-
GOVT_APPROVED_CA
public static final int GOVT_APPROVED_CA- See Also:
-
SSL
public static final int SSL- See Also:
-
EMAIL
public static final int EMAIL- See Also:
-
OBJECT_SIGNING
public static final int OBJECT_SIGNING- See Also:
-
-
Constructor Details
-
X509Certificate
public X509Certificate()
-
-
Method Details
-
getEncoded
- Specified by:
getEncoded
in classCertificate
- Returns:
- The DER encoding of this certificate.
- Throws:
CertificateEncodingException
- If an error occurred.
-
getNickname
- Returns:
- The nickname of this certificate (could be null).
-
getPublicKey
- Specified by:
getPublicKey
in classCertificate
- Returns:
- The Public Key from this certificate.
-
getSubjectDN
- Specified by:
getSubjectDN
in classX509Certificate
- Returns:
- The RFC 1485 ASCII encoding of the Subject Name.
-
getIssuerDN
- Specified by:
getIssuerDN
in classX509Certificate
- Returns:
- The RFC 1485 ASCII encoding of the issuer's Subject Name.
-
getSerialNumber
- Specified by:
getSerialNumber
in classX509Certificate
- Returns:
- The serial number of this certificate.
-
getVersion
public abstract int getVersion()- Specified by:
getVersion
in classX509Certificate
- Returns:
- the version number of this X.509 certificate. 0 means v1, 1 means v2, 2 means v3.
-
isTrustFlagEnabled
public static boolean isTrustFlagEnabled(int flag, int flags) -
encodeTrustFlags
-
decodeTrustFlags
- Throws:
Exception
-
setTrust
public abstract 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
public abstract 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.
-
setSSLTrust
public void setSSLTrust(int trust) Set the SSL trust flags for this certificate.- Specified by:
setSSLTrust
in interfaceInternalCertificate
- Parameters:
trust
- A bitwise OR of the trust flags VALID_PEER, VALID_CA, TRUSTED_CA, USER, and TRUSTED_CLIENT_CA.
-
setEmailTrust
public void setEmailTrust(int trust) Set the email (S/MIME) trust flags for this certificate.- Specified by:
setEmailTrust
in interfaceInternalCertificate
- Parameters:
trust
- A bitwise OR of the trust flags VALID_PEER, VALID_CA, TRUSTED_CA, USER, and TRUSTED_CLIENT_CA.
-
setObjectSigningTrust
public void setObjectSigningTrust(int trust) Set the object signing trust flags for this certificate.- Specified by:
setObjectSigningTrust
in interfaceInternalCertificate
- Parameters:
trust
- A bitwise OR of the trust flags VALID_PEER, VALID_CA, TRUSTED_CA, USER, and TRUSTED_CLIENT_CA.
-
getSSLTrust
public int getSSLTrust()Get the SSL trust flags for this certificate.- Specified by:
getSSLTrust
in interfaceInternalCertificate
- Returns:
- A bitwise OR of the trust flags VALID_PEER, VALID_CA, TRUSTED_CA, USER, and TRUSTED_CLIENT_CA.
-
getEmailTrust
public int getEmailTrust()Get the email (S/MIME) trust flags for this certificate.- Specified by:
getEmailTrust
in interfaceInternalCertificate
- Returns:
- A bitwise OR of the trust flags VALID_PEER, VALID_CA, TRUSTED_CA, USER, and TRUSTED_CLIENT_CA.
-
getObjectSigningTrust
public int getObjectSigningTrust()Get the object signing trust flags for this certificate.- Specified by:
getObjectSigningTrust
in interfaceInternalCertificate
- Returns:
- A bitwise OR of the trust flags VALID_PEER, VALID_CA, TRUSTED_CA, USER, and TRUSTED_CLIENT_CA.
-
getTrustFlags
-
setTrustFlags
- Throws:
Exception
-