use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.OcspInfoType in project X-Road by nordic-institute.
the class SharedParametersV2 method cacheOcspData.
private void cacheOcspData(List<CaInfoType> typesUnderCA) throws CertificateException, IOException {
for (CaInfoType caType : typesUnderCA) {
X509Certificate cert = readCertificate(caType.getCert());
List<OcspInfoType> caOcspTypes = caType.getOcsp();
caCertsAndOcspData.put(cert, caOcspTypes);
}
}
use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.OcspInfoType in project X-Road by nordic-institute.
the class GlobalConfImpl method doGetOcspResponderAddressesForCertificate.
private List<String> doGetOcspResponderAddressesForCertificate(X509Certificate certificate, boolean certificateIsCA) throws Exception {
List<String> responders = new ArrayList<>();
for (SharedParametersV2 p : getSharedParameters()) {
List<OcspInfoType> caOcspData = null;
X509Certificate caCert;
try {
if (!certificateIsCA) {
caCert = getCaCert(null, certificate);
} else {
caCert = certificate;
}
caOcspData = p.getCaCertsAndOcspData().get(caCert);
} catch (CodedException e) {
log.error("Unable to determine OCSP responders: {}", e);
}
if (caOcspData == null) {
continue;
}
caOcspData.stream().map(OcspInfoType::getUrl).filter(StringUtils::isNotBlank).map(String::trim).forEach(responders::add);
}
String uri = CertUtils.getOcspResponderUriFromCert(certificate);
if (uri != null) {
responders.add(uri.trim());
}
return responders;
}
Aggregations