我正在尝试使用域证书和中间证书验证证书路径。证书不包含根证书。有没有办法验证没有提供根证书的证书路径?
由于
--- ----更新 我试过的方法
InputStream trustStoreInput = new FileInputStream(cacertPath);
String password = password;
KeyStore anchors = KeyStore.getInstance(KeyStore.getDefaultType());
anchors.load(trustStoreInput, password.toCharArray());
X509CertSelector target = new X509CertSelector();
target.setCertificate(certList.get(1)); <---I have domain cert and intermediate cert
PKIXBuilderParameters params = new PKIXBuilderParameters(anchors, target);
CertStoreParameters intermediates = new CollectionCertStoreParameters(certList);
params.addCertStore(CertStore.getInstance("Collection", intermediates));
CertPathBuilderResult result = CertPathBuilder.getInstance("PKIX").build(params);
但是我收到了这个错误
unable to find valid certification path to requested target