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.
|
|
CardVerifiableCertificate(CVCPrincipal authorityReference,
CVCPrincipal holderReference,
PublicKey publicKey,
String algorithm,
Date notBefore,
Date notAfter,
CVCAuthorizationTemplate.Role role,
CVCAuthorizationTemplate.Permission permission,
byte[] signatureData)
Constructs a certificate.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object otherObj)
Tests for equality with respect to another object.
|
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.
|
String |
getSigAlgName()
Gets the signature algorithm.
|
String |
getSigAlgOID()
Gets the signature algorithm OID
|
byte[] |
getSignature()
Returns the signature (just the value, without the
0x5F37 tag). |
int |
hashCode()
Gets a hash code for this object.
|
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, verify, writeReplace
protected CardVerifiableCertificate(org.ejbca.cvc.CVCertificate cvCertificate)
cvCertificate
- the EJCBA CVC to wrappublic CardVerifiableCertificate(CVCPrincipal authorityReference, CVCPrincipal holderReference, PublicKey publicKey, String algorithm, Date notBefore, Date notAfter, CVCAuthorizationTemplate.Role role, CVCAuthorizationTemplate.Permission permission, byte[] signatureData)
authorityReference
- authority referenceholderReference
- holder referencepublicKey
- public keyalgorithm
- algorithmnotBefore
- valid from datenotAfter
- valid to daterole
- rolepermission
- permissionsignatureData
- signed datepublic String getSigAlgName()
public String getSigAlgOID()
public byte[] getEncoded() throws CertificateEncodingException
getEncoded
in class Certificate
CertificateEncodingException
- if an encoding error occurs.public PublicKey getPublicKey()
getPublicKey
in class Certificate
public String toString()
toString
in class Certificate
public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify
in class Certificate
key
- 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 Certificate
key
- 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
CertificateException
- on errorpublic Date getNotAfter() throws CertificateException
CertificateException
- on errorpublic 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
CertificateException
- on error constructing the templatepublic byte[] getSignature() throws CertificateException
0x5F37
tag).CertificateException
- if certificate doesn't contain a signaturepublic boolean equals(Object otherObj)
equals
in class Certificate
otherObj
- the other objectpublic int hashCode()
hashCode
in class Certificate
Copyright © 2016. All rights reserved.