// within the CMS signed data
final CMSProcessable sp = s.getSignedContent();
final byte[] content = (byte[]) sp.getContent();
final CMSEnvelopedData ed = new CMSEnvelopedData(content);
final RecipientInformationStore recipients = ed.getRecipientInfos();
CertStore certstore;
{
Collection<RecipientInformation> c = recipients.getRecipients();
assertEquals(c.size(), 1);
Iterator<RecipientInformation> it = c.iterator();
byte[] decBytes = null;
RecipientInformation recipient = it.next();
decBytes = recipient.getContent(key1.getPrivate(), "BC");
// This is yet another CMS signed data
CMSSignedData sd = new CMSSignedData(decBytes);
// Get certificates from the signed data
certstore = sd.getCertificatesAndCRLs("Collection", "BC");
}
if (crlRep) {
// We got a reply with a requested CRL
final Collection<X509CRL> crls = (Collection<X509CRL>) certstore.getCRLs(null);
assertEquals(crls.size(), 1);
final Iterator<X509CRL> it = crls.iterator();
// CRL is first (and only)
final X509CRL retCrl = it.next();
log.info("Got CRL with DN: " + retCrl.getIssuerDN().getName());
// check the returned CRL
assertEquals(cacert.getSubjectDN().getName(), retCrl.getIssuerDN().getName());
retCrl.verify(cacert.getPublicKey());
} else {
// We got a reply with a requested certificate
final Collection<X509Certificate> certs = (Collection<X509Certificate>) certstore.getCertificates(null);
// EJBCA returns the issued cert and the CA cert (cisco vpn
// client requires that the ca cert is included)
if (noca) {
assertEquals(certs.size(), 1);
} else {