public interface CertificateValidator
| Modifier and Type | Method and Description | 
|---|---|
void | 
validateCert(java.security.cert.CertPath cp)
Validate a certificate path of X509Certificates. 
 | 
void validateCert(java.security.cert.CertPath cp)
                  throws CertificateValidatorException
Here is a sample implementation using the CertPathValidator. A real implementation would probably not create a new CertPathValidator every time but possibly store it in a thread local variable public void validateCert(CertPath cp) { try { // set up a certificate validator CertPathValidator cpv = CertPathValidator.getInstance("PKIX"); // .. configure the trust anchor, CRLs OCSP etc // now try to validate CertPathValidatorResult cpvResult = cpv.validate(cp, params); // if there is no exception, validation succeded } catch (CertificateException ex) { throw new CertificateValidatorException(ex); } catch (NoSuchAlgorithmException ex) { throw new CertificateValidatorException(ex); } }
certList - List of X509CertificateCertificateValidatorException - is the certificate chain is invalid