certs = s.getCertificatesAndCRLs("Collection", "BC");
certsAndCrls = s.getCertificatesAndCRLs("Collection", "BC");
    private void encapsulatedTest(        KeyPair         signaturePair,         X509Certificate signatureCert,        String          digestAlgorithm)        throws Exception    {        List                certList = new ArrayList();        CMSProcessable      msg = new CMSProcessableByteArray("Hello World!".getBytes());            certList.add(signatureCert);        certList.add(_origCert);            CertStore           certs = CertStore.getInstance("Collection",                        new CollectionCertStoreParameters(certList), "BC");            CMSSignedDataGenerator gen = new CMSSignedDataGenerator();            gen.addSigner(signaturePair.getPrivate(), signatureCert, digestAlgorithm);            gen.addCertificatesAndCRLs(certs);            CMSSignedData s = gen.generate(msg, true, "BC");            ByteArrayInputStream bIn = new ByteArrayInputStream(s.getEncoded());        ASN1InputStream      aIn = new ASN1InputStream(bIn);                s = new CMSSignedData(ContentInfo.getInstance(aIn.readObject()));            certs = s.getCertificatesAndCRLs("Collection", "BC");            SignerInformationStore  signers = s.getSignerInfos();        Collection              c = signers.getSigners();        Iterator                it = c.iterator();            while (it.hasNext())        {            SignerInformation   signer = (SignerInformation)it.next();            Collection          certCollection = certs.getCertificates(signer.getSID());                Iterator        certIt = certCollection.iterator();            X509Certificate cert = (X509Certificate)certIt.next();                assertEquals(true, signer.verify(cert, "BC"));        }                //        // try using existing signer        //                gen = new CMSSignedDataGenerator();                   gen.addSigners(s.getSignerInfos());                gen.addCertificatesAndCRLs(s.getCertificatesAndCRLs("Collection", "BC"));                   s = gen.generate(msg, true, "BC");            bIn = new ByteArrayInputStream(s.getEncoded());        aIn = new ASN1InputStream(bIn);            s = new CMSSignedData(ContentInfo.getInstance(aIn.readObject()));            certs = s.getCertificatesAndCRLs("Collection", "BC");            signers = s.getSignerInfos();        c = signers.getSigners();        it = c.iterator();            while (it.hasNext())        {            SignerInformation   signer = (SignerInformation)it.next();            Collection          certCollection = certs.getCertificates(signer.getSID());                Iterator        certIt = certCollection.iterator();            X509Certificate cert = (X509Certificate)certIt.next();                assertEquals(true, signer.verify(cert, "BC"));        }                checkSignerStoreReplacement(s, signers);    }