title: Bouncy Castle i cannot get all certificate
body: <p>I'm trying to read certificate from smime.p7s file, the certificate chain is:</p>
  
  <p>Baltimora Cyber Trust --> DigitPA --> Aruba PEC</p>
  
  <p>So when i'm trying to extract, I retrieve only the last two certificate, the last like subject and the first like issuer.
  What am I wrong?</p>
  
  <p>the code:</p>
  
  <pre><code>private List&lt;CertificateInfo&gt; reading(ASN1InputStream asn1Stream) throws IOException, CMSException, CertificateException {
          ArrayList&lt;CertificateInfo&gt; infos = new ArrayList&lt;CertificateInfo&gt;();
          ASN1Primitive obj = asn1Stream.readObject();
          ContentInfo contentInfo = ContentInfo.getInstance(obj);
          CMSSignedData cms = new CMSSignedData(contentInfo);
          JcaX509CertificateConverter converter = new JcaX509CertificateConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME);
          Store store = cms.getCertificates();
          SignerInformationStore signersInfoStore = cms.getSignerInfos();
          Collection&lt;SignerInformation&gt; signers = signersInfoStore.getSigners();
          logger.debug("signers num [" + signers.size() + "]");
          for (SignerInformation si : signers) {
              SignerId sid = si.getSID();
              Collection&lt;X509CertificateHolder&gt; holders = store.getMatches(sid);
              logger.debug("holders num [" + holders.size() + "]");
              for (X509CertificateHolder certholder : holders) {
                  X509Certificate cert = converter.getCertificate(certholder);
                  logger.debug("Issuer [" + cert.getPublicKey() + "]");
                  CertificateInfo certInfo = util.parse(cert);
                  infos.add(certInfo);
              }
          }
          return infos;
      }
  </code></pre>
  
  <p>I'm using these bouncy castle jar like dependecies:</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;bouncycastle&lt;/groupId&gt;
              &lt;artifactId&gt;bcprov-jdk15&lt;/artifactId&gt;
              &lt;version&gt;150&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;bouncycastle&lt;/groupId&gt;
              &lt;artifactId&gt;bcmail-jdk15&lt;/artifactId&gt;
              &lt;version&gt;150&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;bouncycastle&lt;/groupId&gt;
              &lt;artifactId&gt;bcpg-jdk15&lt;/artifactId&gt;
              &lt;version&gt;150&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;bouncycastle&lt;/groupId&gt;
              &lt;artifactId&gt;bcpkix-jdk15&lt;/artifactId&gt;
              &lt;version&gt;150&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>thanks in advance.</p>