assertEquals(2, c.size());
    public void testSHA1AndMD5WithRSAEncapsulatedRepeated()        throws Exception    {        List                certList = new ArrayList();        CMSProcessable      msg = new CMSProcessableByteArray("Hello World!".getBytes());        certList.add(_origCert);        certList.add(_signCert);        CertStore           certs = CertStore.getInstance("Collection",                        new CollectionCertStoreParameters(certList), "BC");        CMSSignedDataGenerator gen = new CMSSignedDataGenerator();        gen.addSigner(_origKP.getPrivate(), _origCert, CMSSignedDataGenerator.DIGEST_SHA1);        gen.addSigner(_origKP.getPrivate(), _origCert, CMSSignedDataGenerator.DIGEST_MD5);                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();                assertEquals(2, signers.size());                Collection              c = signers.getSigners();        Iterator                it = c.iterator();        SignerId                sid = null;        while (it.hasNext())        {            SignerInformation   signer = (SignerInformation)it.next();            Collection          certCollection = certs.getCertificates(signer.getSID());            Iterator        certIt = certCollection.iterator();            X509Certificate cert = (X509Certificate)certIt.next();            sid = signer.getSID();                        assertEquals(true, signer.verify(cert, "BC"));        }                c = signers.getSigners(sid);                assertEquals(2, c.size());                //        // 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);    }