CmsReader { @SuppressWarnings("unchecked") static Collection<X509Certificate> getCertificates(CertStore certStore, SignerId sid) throws CertStoreException { X509CertSelector selector = new JcaX509CertSelectorConverter().getCertSelector(sid); return (Collection<X509Certificate>) certStore.getCertificates(selector); } private  CmsReader(); static byte[] decryptAndVerify(
		byte[] encryptedData,
		List<X509Certificate> expectedSignatureCerts,
		X509Certificate recipientCertificate,
		PrivateKey recipientPrivateKey); static CertStore createCertStore(Collection<X509Certificate> allCerts);  }
@Test public void testGetCertificates() throws Exception { X509Certificate c1 = (X509Certificate) X509CertBuilder.createTemporaryCert("cn1", "a1", "pass").getCertificate("a1"); X509Certificate c2 = (X509Certificate) X509CertBuilder.createTemporaryCert("cn2", "a2", "pass").getCertificate("a2"); CertStore certStore = CmsReader.createCertStore(Arrays.asList(c1, c2)); assertThat(CmsReader.getCertificates(certStore, new JcaSignerId(c1)), Matchers.contains(c1)); assertThat(CmsReader.getCertificates(certStore, new JcaSignerId(c2)), Matchers.contains(c2)); }