public class CardVerifiableCertificate extends Certificate
org.ejbca.cvc.CVCertificate by Keijo Kurkinen of EJBCA.org,
so that we can subclass java.security.cert.Certificate.
We also hide some of the internal structure (no more calls to get the "body" just to get some
attributes).Certificate.CertificateRep| Modifier | Constructor and Description |
|---|---|
protected |
CardVerifiableCertificate(org.ejbca.cvc.CVCertificate cvCertificate)
Constructs a wrapper.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object otherObj) |
CVCPrincipal |
getAuthorityReference()
Gets the authority reference.
|
CVCAuthorizationTemplate |
getAuthorizationTemplate()
Gets the holder authorization template.
|
byte[] |
getCertBodyData()
The DER encoded certificate body.
|
byte[] |
getEncoded()
Returns the encoded form of this certificate.
|
CVCPrincipal |
getHolderReference()
Gets the holder reference.
|
Date |
getNotAfter()
Returns 'Expiration Date'.
|
Date |
getNotBefore()
Returns 'Effective Date'.
|
PublicKey |
getPublicKey()
Gets the public key from this certificate.
|
byte[] |
getSignature()
Returns the signature (just the value, without the
0x5F37 tag). |
int |
hashCode() |
String |
toString()
Returns a string representation of this certificate.
|
void |
verify(PublicKey key)
Verifies that this certificate was signed using the
private key that corresponds to the specified public key.
|
void |
verify(PublicKey key,
String provider)
Verifies that this certificate was signed using the
private key that corresponds to the specified public key.
|
getType, writeReplaceprotected CardVerifiableCertificate(org.ejbca.cvc.CVCertificate cvCertificate)
cvCertificate - the EJCBA CVC to wrappublic byte[] getEncoded()
throws CertificateEncodingException
getEncoded in class CertificateCertificateEncodingException - if an encoding error occurs.public PublicKey getPublicKey()
getPublicKey in class Certificatepublic String toString()
toString in class Certificatepublic void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify in class Certificatekey - the PublicKey used to carry out the verification.NoSuchAlgorithmException - on unsupported signature
algorithms.InvalidKeyException - on incorrect key.NoSuchProviderException - if there's no default provider.SignatureException - on signature errors.CertificateException - on encoding errors.public void verify(PublicKey key, String provider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify in class Certificatekey - the PublicKey used to carry out the verification.provider - the name of the signature provider.NoSuchAlgorithmException - on unsupported signature algorithms.InvalidKeyException - on incorrect key.NoSuchProviderException - on incorrect provider.SignatureException - on signature errors.CertificateException - on encoding errors.public byte[] getCertBodyData()
throws CertificateException,
IOException
CertificateException - on errorIOException - on errorpublic Date getNotBefore() throws CertificateException
CertificateExceptionpublic Date getNotAfter() throws CertificateException
CertificateExceptionpublic CVCPrincipal getAuthorityReference() throws CertificateException
CertificateException - if the authority reference field is not presentpublic CVCPrincipal getHolderReference() throws CertificateException
CertificateException - if the authority reference field is not presentpublic CVCAuthorizationTemplate getAuthorizationTemplate() throws CertificateException
CertificateExceptionpublic byte[] getSignature()
throws CertificateException
0x5F37 tag).CertificateException - if certificate doesn't contain a signaturepublic boolean equals(Object otherObj)
equals in class Certificatepublic int hashCode()
hashCode in class Certificate