|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.x509.ChainVerifier
This class provides a framework that allows you to verify certificate
chains. It implements the cryptographic verification logic, but has to
be subclassed for the trust verification, see the SimpleChainVerifier
class for a basic implementation of such logic.
See the documentation of the verifyChain
method for more information about the verification that is performed.
NOTE: This class currently includes only a very basic support for X.509v3 extensions.
SimpleChainVerifier
Constructor Summary | |
protected |
ChainVerifier()
Constructor for use by subclasses. |
Method Summary | |
protected void |
checkExtensions(X509Certificate[] certificateChain,
int index)
Verifies if the extensions in the certificate at the given index in the certificate chain are valid. |
abstract boolean |
isTrustedCertificate(X509Certificate cert)
Tests whether the given certificate is explicitly trusted. |
static X509Certificate[] |
orderCertificateChain(X509Certificate leaf,
X509Certificate[] certs)
Reorder a set of certificates so that it becomes a valid chain. |
boolean |
verifyChain(X509Certificate[] certificateChain)
This method verifies a certificate chain. |
boolean |
verifyChain(X509Certificate[] certificateChain,
boolean reversed)
This method verifies a (reversed) certificate chain. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ChainVerifier()
Method Detail |
public abstract boolean isTrustedCertificate(X509Certificate cert) throws CertificateException
verifyChain
.cert
- the certificate to be checkedtrue
if the certificate shall be trusted,
false
if notpublic boolean verifyChain(X509Certificate[] certificateChain) throws CertificateException
certificateChain
- the certificate chain to be checkedCertificateException
- if there is some error in the certificate
chainprotected void checkExtensions(X509Certificate[] certificateChain, int index) throws CertificateException
NOTE: This method currently only works for instances of iaik.x509.X509Certificate, for other subclasses of java.security.cert.X509Certificate no extension checking will be done at all.
The handling of X.509 extensions by this class is far from complete. If you
want to implement your own extension checking, override this method. It is
supposed to be called only by verifyChain()
.
Current handling of extensions:
KeyUsage.keyCertSign
if the
extension is present.
certificateChain
- the certificate chain containing the certificate to be checkedindex
- the index of the certificate to be checkedCertificateException
- if the verification failspublic boolean verifyChain(X509Certificate[] certificateChain, boolean reversed) throws CertificateException
certificateChain
- the certificate chain to be verifiedreversed
- whether the user certificate is loacted at index 0 (reversed = false), or
at index n-1 (reversed = true)CertificateException
- if there is some error in the certificate
chainpublic static X509Certificate[] orderCertificateChain(X509Certificate leaf, X509Certificate[] certs) throws CertificateException
leaf
- the leaf certificatecerts
- the certificate chain to be reorderedCertificateException
- if a required issuer certificate cannot
be found in the set of certificates.
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |