When the checkServerTrusted
method of classes implementing X509TrustManager
is invoked, I need to get ALL validation errors that are associated with a certificate chain including
- Certificate path validation problems. e.g CA not trusted
- Certificate fields validation problems. e.g Expired certificate, Invalid extended key usage
The motivation behind this is so that I can present the user with the certificate validation issues before he adds it as an "exception" as Firefox does now. However, right now, as soon as a path validation issue is found, a CertPathValidatorException
is thrown, but it gives me no information about the validity of the fields in the certificate. How can I implement this?
After some reading, I found the CertPath
API provides such features, and found that the PKIX implementation is a wrapper around this, but just does not return the CertPathValidatorResult
. I would like to make maximum use of existing JAVA functionality(without writing my own custom wrapper to the API) while returning all validation issues.