trustAnchors.add(new TrustAnchor((X509Certificate) chain[i], null));
}
}
}
PKIXBuilderParameters pkixParameters = new PKIXBuilderParameters(trustAnchors, selector);
pkixParameters.setRevocationEnabled(false);
List<Certificate> list = new ArrayList<Certificate>();
for (int i = 0; i < chain.length; i++) {
if ((!localCA) || ((localCA) && (!Certificates.isSelfSigned(chain[i])))) {
list.add(chain[i]);
}
}
if (!Conditions.isEmpty(list)) {
CertStore intermediateCertStore = CertStore.getInstance(PKIXCertificateValidator.CERTSTORE_TYPE, new CollectionCertStoreParameters(list), BouncyCastleProviderHelper.PROVIDER_NAME);
pkixParameters.addCertStore(intermediateCertStore);
}
CertPathBuilder builder = CertPathBuilder.getInstance(PKIXCertificateValidator.CERTPATH_TYPE, BouncyCastleProviderHelper.PROVIDER_NAME);
PKIXCertPathBuilderResult builderResult = (PKIXCertPathBuilderResult) builder.build(pkixParameters);
CertPathValidator validator = CertPathValidator.getInstance(PKIXCertificateValidator.CERTPATH_TYPE, BouncyCastleProviderHelper.PROVIDER_NAME);