use of ee.ria.xroad.common.ErrorCodes.X_INTERNAL_ERROR in project X-Road by nordic-institute.
the class GlobalConfImpl method getCaCert.
@Override
public X509Certificate getCaCert(String instanceIdentifier, X509Certificate memberCert) throws Exception {
if (memberCert == null) {
throw new IllegalArgumentException("Member certificate must be present to find CA cert!");
}
X509CertificateHolder ch = new X509CertificateHolder(memberCert.getEncoded());
String[] instances = instanceIdentifier != null ? new String[] { instanceIdentifier } : new String[] {};
return getSharedParameters(instances).stream().map(p -> p.getSubjectsAndCaCerts().get(ch.getIssuer())).filter(Objects::nonNull).findFirst().orElseThrow(() -> new CodedException(X_INTERNAL_ERROR, "Certificate is not issued by approved " + "certification service provider."));
}
Aggregations