RecipientInformation recipient = (RecipientInformation) it.next();
decBytes = recipient.getContent(keys.getPrivate(), "BC");
// This is yet another CMS signed data
CMSSignedData sd = new CMSSignedData(decBytes);
// Get certificates from the signed data
CertStore certstore = sd.getCertificatesAndCRLs("Collection","BC");
if (crlRep) {
// We got a reply with a requested CRL
Collection crls = certstore.getCRLs(null);
assertEquals(crls.size(), 1);
it = crls.iterator();
X509CRL retCrl = null;
// CRL is first (and only)
retCrl = (X509CRL)it.next();
log.info("Got CRL with DN: "+ retCrl.getIssuerDN().getName());
// try {
// FileOutputStream fos = new FileOutputStream("sceptest.der");
// fos.write(retCrl.getEncoded());
// fos.close();
// } catch (Exception e) {}
// check the returned CRL
assertEquals(cacert.getSubjectDN().getName(), retCrl.getIssuerDN().getName());
retCrl.verify(cacert.getPublicKey());
} else {
// We got a reply with a requested certificate
Collection certs = certstore.getCertificates(null);
log.info("Got certificate reply with certchain of length: "+certs.size());
// 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 {