use of org.bouncycastle.asn1.crmf.ProofOfPossession in project xipki by xipki.
the class CaClientImpl method envelope.
@Override
public byte[] envelope(CertRequest certRequest, ProofOfPossession pop, String profileName, String caName) throws CaClientException {
ParamUtil.requireNonNull("certRequest", certRequest);
ParamUtil.requireNonNull("pop", pop);
profileName = ParamUtil.requireNonNull("profileName", profileName).toLowerCase();
init0(false);
if (caName == null) {
// detect the CA name
caName = getCaNameForProfile(profileName);
if (caName == null) {
throw new CaClientException("certprofile " + profileName + " is not supported by any CA");
}
} else {
caName = caName.toLowerCase();
checkCertprofileSupportInCa(profileName, caName);
}
CaConf ca = casMap.get(caName);
if (ca == null) {
throw new CaClientException("could not find CA named " + caName);
}
PKIMessage pkiMessage;
try {
pkiMessage = ca.getRequestor().envelope(certRequest, pop, profileName);
} catch (CmpRequestorException ex) {
throw new CaClientException("CmpRequestorException: " + ex.getMessage(), ex);
}
try {
return pkiMessage.getEncoded();
} catch (IOException ex) {
throw new CaClientException("IOException: " + ex.getMessage(), ex);
}
}
Aggregations