title: Explore a bouncy castle store object
body: <p>My question is strictly related to <a href="https://stackoverflow.com/questions/22202771/bouncy-castle-i-cannot-get-all-certificate">Bouncy Castle i cannot get all certificate</a>.</p>
  
  <p>I use the BC code <a href="https://www.bouncycastle.org/docs/pkixdocs1.4/org/bouncycastle/cms/CMSSignedData.html" rel="nofollow noreferrer">https://www.bouncycastle.org/docs/pkixdocs1.4/org/bouncycastle/cms/CMSSignedData.html</a> whith some little variation.</p>
  
  <pre><code>  Store                   certStore = s.getCertificates();
    SignerInformationStore  signers = s.getSignerInfos();
    Collection              c = signers.getSigners();
    Iterator                it = c.iterator();
  
    while (it.hasNext())
    {
        SignerInformation   signer = (SignerInformation)it.next();
        Collection          certCollection = certStore.getMatches(signer.getSID());
  
        Iterator              certIt = certCollection.iterator();
        X509CertificateHolder cert = (X509CertificateHolder)certIt.next();
  
        if (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert)))
        {
            verified++;
        }   
    }
  </code></pre>
  
  <p>My purpose is to extract all certificate(signers + them issuers) from the "certStore" , and verify them against a specicific keystore.</p>
  
  <p>But to extract a certificate form certStore, there is only "certStore.getMatches".</p>
  
  <p>The signers extract obviously only the signers and used in "certStore.getMatches" extract only the certificate of the signer(one or more).</p>
  
  <p>I have to control each certificate, his CRL his date, not only the signer.</p>