firstCertificate = resp.getCertificate();
assertNotNull(firstCertificate);
// Check the pkcs7 response
byte[] pkcs7 = resp.getCertificateAsPKCS7();
assertNotNull(pkcs7);
CMSSignedData s = new CMSSignedData(pkcs7);
// The signer, i.e. the CA, check it's the right CA
SignerInformationStore signers = s.getSignerInfos();
Collection col = signers.getSigners();
assertTrue(col.size() > 0);
Iterator siter = col.iterator();
SignerInformation signerInfo = (SignerInformation)siter.next();
SignerId sinfo = signerInfo.getSID();
// Check that the signer is the expected CA
assertEquals(CertTools.stringToBCDNString(firstCertificate.getIssuerDN().getName()), CertTools.stringToBCDNString(sinfo.getIssuerAsString()));
CertStore certstore = s.getCertificatesAndCRLs("Collection","BC");
Collection certs = certstore.getCertificates(null);
assertEquals(certs.size(), 2);
Iterator it = certs.iterator();
boolean found = false;
while (it.hasNext()) {