resp = s.getEncoded();
}
if ((serviceReq.getMode() & CmsCAServiceRequest.MODE_ENCRYPT) != 0) {
CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator();
edGen.addKeyTransRecipient(getCMSCertificate());
CMSEnvelopedData ed = edGen.generate(new CMSProcessableByteArray(resp),CMSEnvelopedDataGenerator.DES_EDE3_CBC,"BC");
resp = ed.getEncoded();
}
if ((serviceReq.getMode() & CmsCAServiceRequest.MODE_DECRYPT) != 0) {
CMSEnvelopedData ed = new CMSEnvelopedData(resp);
RecipientInformationStore recipients = ed.getRecipientInfos();
RecipientId id = new RecipientId();
id.setIssuer(getCMSCertificate().getIssuerX500Principal());
id.setSerialNumber(getCMSCertificate().getSerialNumber());
RecipientInformation recipient = recipients.get(id);
if (recipient != null) {