use of org.xipki.ca.client.api.dto.CsrEnrollCertRequest in project xipki by xipki.
the class CaClientImpl method requestCert.
@Override
public EnrollCertResult requestCert(String caName, CertificationRequest csr, String profile, Date notBefore, Date notAfter, RequestResponseDebug debug) throws CaClientException, PkiErrorException {
ParamUtil.requireNonNull("csr", csr);
if (caName == null) {
caName = getCaNameForProfile(profile);
} else {
caName = caName.toLowerCase();
}
if (caName == null) {
throw new CaClientException("certprofile " + profile + " is not supported by any CA");
}
CaConf ca = casMap.get(caName);
if (ca == null) {
throw new CaClientException("could not find CA named " + caName);
}
final String id = "cert-1";
CsrEnrollCertRequest request = new CsrEnrollCertRequest(id, profile, csr);
EnrollCertResultResp result;
try {
result = ca.getRequestor().requestCertificate(request, notBefore, notAfter, debug);
} catch (CmpRequestorException ex) {
throw new CaClientException(ex.getMessage(), ex);
}
return parseEnrollCertResult(result);
}
Aggregations