use of org.nhindirect.stagent.cert.impl.UniformCertificateStore in project nhin-d by DirectProject.
the class TrustChainValidator_IntermidiateCert_Test method testValidateChain_IntermediatePublicResolver_OpenSSLCerts.
public void testValidateChain_IntermediatePublicResolver_OpenSSLCerts() throws Exception {
X509Certificate anchor = certFromData(getCertificateFileData("cert-c.der"));
X509Certificate certToValidate = certFromData(getCertificateFileData("cert-a.der"));
// uniform cert store that will just spit out whatever we put in it
// will put the anchor in the public resolver... validator should hit it
X509Certificate intermediateCert = certFromData(getCertificateFileData("cert-b.der"));
CertificateResolver publicResolver = new UniformCertificateStore(intermediateCert);
TrustChainValidator validator = new TrustChainValidator();
validator.setCertificateResolver(Arrays.asList(publicResolver));
boolean isTrusted = false;
try {
isTrusted = validator.isTrusted(certToValidate, Arrays.asList(anchor));
} catch (Exception e) {
}
assertTrue(isTrusted);
}
use of org.nhindirect.stagent.cert.impl.UniformCertificateStore in project nhin-d by DirectProject.
the class TrustChainValidator_IntermidiateCert_Test method testValidateCertAgainstNonRootCA_CAInPublicResolver_OpenSSLCerts.
public void testValidateCertAgainstNonRootCA_CAInPublicResolver_OpenSSLCerts() throws Exception {
X509Certificate anchor = certFromData(getCertificateFileData("cert-b.der"));
X509Certificate certToValidate = certFromData(getCertificateFileData("cert-a.der"));
// uniform cert store that will just spit out whatever we put in it
// will put the anchor in the public resolver... validator should hit it
CertificateResolver publicResolver = new UniformCertificateStore(anchor);
TrustChainValidator validator = new TrustChainValidator();
validator.setCertificateResolver(Arrays.asList(publicResolver));
boolean isTrusted = false;
try {
isTrusted = validator.isTrusted(certToValidate, Arrays.asList(anchor));
} catch (Exception e) {
}
assertTrue(isTrusted);
}
Aggregations