}
// Create a failure message
PKIStatusInfo myPKIStatusInfo = new PKIStatusInfo(new DERInteger(2)); // 2 = rejection
myPKIStatusInfo.setFailInfo(failInfo.getAsBitString());
if (failText != null) {
myPKIStatusInfo.setStatusString(new PKIFreeText(new DERUTF8String(failText)));
}
PKIBody myPKIBody = CmpMessageHelper.createCertRequestRejectBody(myPKIHeader, myPKIStatusInfo, requestId, requestType);
PKIMessage myPKIMessage = new PKIMessage(myPKIHeader, myPKIBody);
if ( (pbeKeyId != null) && (pbeKey != null) && (pbeDigestAlg != null) && (pbeMacAlg != null) ) {
responseMessage = CmpMessageHelper.protectPKIMessageWithPBE(myPKIMessage, pbeKeyId, pbeKey, pbeDigestAlg, pbeMacAlg, pbeIterationCount);
} else {
responseMessage = CmpMessageHelper.signPKIMessage(myPKIMessage, (X509Certificate)signCert, signKey, digestAlg, provider);
}
ret = true;
} else {
if (log.isDebugEnabled()) {
log.debug("Creating a 'waiting' message?");
}
// Not supported, lets create a PKIError failure instead
// Create a failure message
PKIStatusInfo myPKIStatusInfo = new PKIStatusInfo(new DERInteger(2)); // 2 = rejection
myPKIStatusInfo.setFailInfo(failInfo.getAsBitString());
if (failText != null) {
myPKIStatusInfo.setStatusString(new PKIFreeText(new DERUTF8String(failText)));
}
ErrorMsgContent myErrorContent = new ErrorMsgContent(myPKIStatusInfo);
PKIBody myPKIBody = new PKIBody(myErrorContent, 23); // 23 = error
PKIMessage myPKIMessage = new PKIMessage(myPKIHeader, myPKIBody);
if ( (pbeKeyId != null) && (pbeKey != null) && (pbeDigestAlg != null) && (pbeMacAlg != null) ) {