public class X509V1CertImpl extends X509Certificate implements Serializable
Constructor and Description |
---|
X509V1CertImpl()
Default constructor.
|
X509V1CertImpl(byte[] certData)
Unmarshals a certificate from its encoded form, parsing the
encoded bytes.
|
X509V1CertImpl(InputStream in)
unmarshals an X.509 certificate from an input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
checkValidity()
Checks that the certificate is currently valid, i.e. the current
time is within the specified validity period.
|
void |
checkValidity(Date date)
Checks that the specified date is within the certificate's
validity period, or basically if the certificate would be
valid at the specified date/time.
|
byte[] |
getEncoded()
Returns the encoded form of this certificate.
|
Principal |
getIssuerDN()
Gets the issuer distinguished name from the certificate.
|
Date |
getNotAfter()
Gets the notAfter date from the validity period of the certificate.
|
Date |
getNotBefore()
Gets the notBefore date from the validity period of the certificate.
|
PublicKey |
getPublicKey()
Gets the publickey from this certificate.
|
BigInteger |
getSerialNumber()
Gets the serial number from the certificate.
|
String |
getSigAlgName()
Gets the signature algorithm name for the certificate
signature algorithm.
|
String |
getSigAlgOID()
Gets the signature algorithm OID string from the certificate.
|
byte[] |
getSigAlgParams()
Gets the DER encoded signature algorithm parameters from this
certificate's signature algorithm.
|
Principal |
getSubjectDN()
Gets the subject distinguished name from the certificate.
|
int |
getVersion()
Gets the
version (version number) value from the
certificate. |
X509Certificate |
getX509Certificate() |
String |
toString()
Returns a printable representation of the certificate.
|
void |
verify(PublicKey key)
Throws an exception if the certificate was not signed using the
verification key provided.
|
void |
verify(PublicKey key,
String sigProvider)
Throws an exception if the certificate was not signed using the
verification key provided.
|
getInstance, getInstance
equals, hashCode
public X509V1CertImpl()
public X509V1CertImpl(byte[] certData) throws CertificateException
certData
- the encoded bytes, with no trailing padding.CertificateException
- on parsing errors.public X509V1CertImpl(InputStream in) throws CertificateException
in
- an input stream holding at least one certificateCertificateException
- on parsing errors.public byte[] getEncoded() throws CertificateEncodingException
getEncoded
in class Certificate
CertificateEncodingException
- on internal certificate
encoding failurepublic void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify
in class Certificate
key
- the public key used for verification.CertificateException
- on encoding errors.NoSuchAlgorithmException
- on unsupported signature
algorithms.InvalidKeyException
- on incorrect key.NoSuchProviderException
- if there's no default provider.SignatureException
- on signature errors.public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify
in class Certificate
key
- the public key used for verification.sigProvider
- the name of the provider.CertificateException
- on encoding errors.NoSuchAlgorithmException
- on unsupported signature algorithms.InvalidKeyException
- on incorrect key.NoSuchProviderException
- on incorrect provider.SignatureException
- on signature errors.public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException
checkValidity
in class X509Certificate
CertificateExpiredException
- if the certificate has expired.CertificateNotYetValidException
- if the certificate is not
yet valid.public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException
checkValidity
in class X509Certificate
date
- the Date to check against to see if this certificate
is valid at that date/time.CertificateExpiredException
- if the certificate has expired
with respect to the date
supplied.CertificateNotYetValidException
- if the certificate is not
yet valid with respect to the date
supplied.X509Certificate.checkValidity()
public String toString()
toString
in class Certificate
public PublicKey getPublicKey()
getPublicKey
in class Certificate
public int getVersion()
X509Certificate
version
(version number) value from the
certificate. The ASN.1 definition for this is:
version [0] EXPLICIT Version DEFAULT v1Version ::= INTEGER { v1(0), v2(1), v3(2) }
getVersion
in class X509Certificate
public BigInteger getSerialNumber()
getSerialNumber
in class X509Certificate
public Principal getSubjectDN()
getSubjectDN
in class X509Certificate
CertificateException
- if a parsing error occurs.X509Certificate.getIssuerDN()
public Principal getIssuerDN()
getIssuerDN
in class X509Certificate
CertificateException
- if a parsing error occurs.public Date getNotBefore()
getNotBefore
in class X509Certificate
CertificateException
- if a parsing error occurs.X509Certificate.checkValidity()
public Date getNotAfter()
getNotAfter
in class X509Certificate
CertificateException
- if a parsing error occurs.X509Certificate.checkValidity()
public String getSigAlgName()
getSigAlgName
in class X509Certificate
CertificateException
- if a parsing error occurs.public String getSigAlgOID()
getSigAlgOID
in class X509Certificate
CertificateException
- if a parsing error occurs.public byte[] getSigAlgParams()
getSigAlgParams
in class X509Certificate
CertificateException
- if a parsing error occurs.public X509Certificate getX509Certificate()