public class WrappedX509Certificate extends X509Certificate
Certificate.CertificateRep| Constructor and Description |
|---|
WrappedX509Certificate(X509Certificate wrapped) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkValidity()
Checks whether the certificate is currently valid.
|
void |
checkValidity(Date date)
Checks whether the certificate is valid at the specified date.
|
int |
getBasicConstraints()
Returns the path length of the certificate constraints from the
BasicContraints extension. |
Set<String> |
getCriticalExtensionOIDs()
Returns the set of OIDs of the extension(s) marked as CRITICAL, that this
implementation manages.
|
byte[] |
getEncoded()
Returns the encoded representation for this certificate.
|
byte[] |
getExtensionValue(String oid)
Returns the extension value as DER-encoded OCTET string for the specified
OID.
|
Principal |
getIssuerDN()
Returns the
issuer (issuer distinguished name) as an
implementation specific Principal object. |
boolean[] |
getIssuerUniqueID()
Returns the
issuerUniqueID from the certificate. |
boolean[] |
getKeyUsage()
Returns the
KeyUsage extension as a boolean array. |
Set<String> |
getNonCriticalExtensionOIDs()
Returns the set of OIDs of the extension(s) marked as NON-CRITICAL, that
this implementation manages.
|
Date |
getNotAfter()
Returns the
notAfter date of the validity period of the
certificate. |
Date |
getNotBefore()
Returns the
notBefore date from the validity period of the
certificate. |
PublicKey |
getPublicKey()
Returns the public key corresponding to this certificate.
|
BigInteger |
getSerialNumber()
Returns the
serialNumber of the certificate. |
String |
getSigAlgName()
Returns the name of the algorithm for the certificate signature.
|
String |
getSigAlgOID()
Returns the OID of the signature algorithm from the certificate.
|
byte[] |
getSigAlgParams()
Returns the parameters of the signature algorithm in DER-encoded format.
|
byte[] |
getSignature()
Returns the raw signature bits from the certificate.
|
Principal |
getSubjectDN()
Returns the
subject (subject distinguished name) as an
implementation specific Principal object. |
boolean[] |
getSubjectUniqueID()
Returns the
subjectUniqueID from the certificate. |
byte[] |
getTBSCertificate()
Returns the
tbsCertificate information from this certificate in
DER-encoded format. |
int |
getVersion()
Returns the certificates
version (version number). |
boolean |
hasUnsupportedCriticalExtension()
Returns whether this instance has an extension marked as CRITICAL that it
cannot support.
|
String |
toString()
Returns a string containing a concise, human-readable description of the
certificate.
|
void |
verify(PublicKey key)
Verifies that this certificate was signed with the given public key.
|
void |
verify(PublicKey key,
String sigProvider)
Verifies that this certificate was signed with the given public key.
|
getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerX500Principal, getSubjectAlternativeNames, getSubjectX500Principalequals, getType, hashCode, writeReplacepublic WrappedX509Certificate(X509Certificate wrapped)
public Set<String> getCriticalExtensionOIDs()
X509Extensionnull if no extensions are
present.public byte[] getExtensionValue(String oid)
X509Extensionoid - the object identifier to get the extension value for.null
if no extension for the specified OID can be found.public Set<String> getNonCriticalExtensionOIDs()
X509Extensionnull if no
extensions are present.public boolean hasUnsupportedCriticalExtension()
X509Extensiontrue if an unsupported CRITICAL extension is present,
false otherwise.public void checkValidity()
throws CertificateExpiredException,
CertificateNotYetValidException
X509CertificateThe validity defined in ASN.1:
validity Validity
Validity ::= SEQUENCE {
notBefore CertificateValidityDate,
notAfter CertificateValidityDate }
CertificateValidityDate ::= CHOICE {
utcTime UTCTime,
generalTime GeneralizedTime }
checkValidity in class X509CertificateCertificateExpiredException - if the certificate has expired.CertificateNotYetValidException - if the certificate is not yet valid.public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException
X509CertificatecheckValidity in class X509Certificatedate - the date to check the validity against.CertificateExpiredException - if the certificate has expired.CertificateNotYetValidException - if the certificate is not yet valid.X509Certificate.checkValidity()public int getVersion()
X509Certificateversion (version number).
The version defined is ASN.1:
Version ::= INTEGER { v1(0), v2(1), v3(2) }
getVersion in class X509Certificatepublic BigInteger getSerialNumber()
X509CertificateserialNumber of the certificate.
The ASN.1 definition of serialNumber:
CertificateSerialNumber ::= INTEGER
getSerialNumber in class X509Certificatepublic Principal getIssuerDN()
X509Certificateissuer (issuer distinguished name) as an
implementation specific Principal object.
The ASN.1 definition of issuer:
issuer Name
Name ::= CHOICE {
RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
type AttributeType,
value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
replaced by: X509Certificate.getIssuerX500Principal().getIssuerDN in class X509Certificateissuer as an implementation specific Principal.public Principal getSubjectDN()
X509Certificatesubject (subject distinguished name) as an
implementation specific Principal object.
The ASN.1 definition of subject:
subject Name
Name ::= CHOICE {
RDNSequence }
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
type AttributeType,
value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
replaced by: X509Certificate.getSubjectX500Principal().
getSubjectDN in class X509Certificatesubject (subject distinguished name).public Date getNotBefore()
X509CertificatenotBefore date from the validity period of the
certificate.getNotBefore in class X509Certificatepublic Date getNotAfter()
X509CertificatenotAfter date of the validity period of the
certificate.getNotAfter in class X509Certificatepublic byte[] getTBSCertificate()
throws CertificateEncodingException
X509CertificatetbsCertificate information from this certificate in
DER-encoded format.getTBSCertificate in class X509CertificateCertificateEncodingException - if an error occurs in encodingpublic byte[] getSignature()
X509CertificategetSignature in class X509Certificatepublic String getSigAlgName()
X509CertificategetSigAlgName in class X509Certificatepublic String getSigAlgOID()
X509CertificategetSigAlgOID in class X509Certificatepublic byte[] getSigAlgParams()
X509CertificategetSigAlgParams in class X509Certificatenull if
none are used.public boolean[] getIssuerUniqueID()
X509CertificateissuerUniqueID from the certificate.getIssuerUniqueID in class X509CertificateissuerUniqueID or null if there's none in the
certificate.public boolean[] getSubjectUniqueID()
X509CertificatesubjectUniqueID from the certificate.getSubjectUniqueID in class X509CertificatesubjectUniqueID or null if there's none in the
certificate.public boolean[] getKeyUsage()
X509CertificateKeyUsage extension as a boolean array.
The ASN.1 definition of KeyUsage:
KeyUsage ::= BIT STRING {
digitalSignature (0),
nonRepudiation (1),
keyEncipherment (2),
dataEncipherment (3),
keyAgreement (4),
keyCertSign (5),
cRLSign (6),
encipherOnly (7),
decipherOnly (8) }
getKeyUsage in class X509CertificateKeyUsage extension or null if there's none in
the certificate.public int getBasicConstraints()
X509CertificateBasicContraints extension.
If the certificate has no basic constraints or is not a
certificate authority, -1 is returned. If the
certificate is a certificate authority without a path length,
Integer.MAX_VALUE is returned. Otherwise, the
certificate authority's path length is returned.getBasicConstraints in class X509Certificatepublic byte[] getEncoded()
throws CertificateEncodingException
CertificategetEncoded in class CertificateCertificateEncodingException - if the encoding fails.public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
Certificateverify in class Certificatekey - PublicKey public key for which verification should be
performed.CertificateException - if encoding errors are detected.NoSuchAlgorithmException - if an unsupported algorithm is detected.InvalidKeyException - if an invalid key is detected.NoSuchProviderException - if there is no default provider.SignatureException - if signature errors are detected.public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
Certificateverify in class Certificatekey - PublicKey public key for which verification should be
performed.sigProvider - String the name of the signature provider.CertificateException - if encoding errors are detected.NoSuchAlgorithmException - if an unsupported algorithm is detected.InvalidKeyException - if an invalid key is detected.NoSuchProviderException - if the specified provider does not exists.SignatureException - if signature errors are detected.public String toString()
CertificatetoString in class Certificatepublic PublicKey getPublicKey()
CertificategetPublicKey in class Certificate