@Test public void testEngineGetCertificatesCertSelector() throws Exception { SimpleMemoryCertStoreParams params = new SimpleMemoryCertStoreParams(null, null); store = new SimpleMemoryCertStore(params); assertEquals(0, store.engineGetCertificates(new X509CertSelector()).size()); params = new SimpleMemoryCertStoreParams(new X509Certificate[] {cert}, new X509CRL[] {crl}); store = new SimpleMemoryCertStore(params); assertEquals(1, store.engineGetCertificates(new X509CertSelector()).size()); params = new SimpleMemoryCertStoreParams(new X509Certificate[] {cert}, new X509CRL[] {crl}); store = new SimpleMemoryCertStore(params); X509CertSelector selector = new X509CertSelector(); selector.setSubject(cert.getSubjectX500Principal()); assertEquals(1, store.engineGetCertificates(selector).size()); X509CertSelector certSelector = new X509CertSelector(); certSelector.setSubject("CN=non-existent"); assertEquals(0, store.engineGetCertificates(certSelector).size()); }
@Override public Collection<? extends Certificate> engineGetCertificates(CertSelector selector) throws CertStoreException { List<X509Certificate> l = new LinkedList<X509Certificate>(); X509CertSelector select = (X509CertSelector) selector; for (X509Certificate cert : certStore) { if (selector.match(cert)) { l.add(cert); } } return l; }
SimpleMemoryCertStore extends CertStoreSpi { @Override public Collection<? extends Certificate> engineGetCertificates(CertSelector selector) throws CertStoreException { List<X509Certificate> l = new LinkedList<X509Certificate>(); X509CertSelector select = (X509CertSelector) selector; for (X509Certificate cert : certStore) { if (selector.match(cert)) { l.add(cert); } } return l; } }
SimpleMemoryCertStore extends CertStoreSpi { @Override public Collection<? extends Certificate> engineGetCertificates(CertSelector selector) throws CertStoreException { List<X509Certificate> l = new LinkedList<X509Certificate>(); X509CertSelector select = (X509CertSelector) selector; for (X509Certificate cert : certStore) { if (selector.match(cert)) { l.add(cert); } } return l; } SimpleMemoryCertStore(CertStoreParameters params); }
SimpleMemoryCertStore extends CertStoreSpi { @Override public Collection<? extends Certificate> engineGetCertificates(CertSelector selector) throws CertStoreException { List<X509Certificate> l = new LinkedList<X509Certificate>(); X509CertSelector select = (X509CertSelector) selector; for (X509Certificate cert : certStore) { if (selector.match(cert)) { l.add(cert); } } return l; } SimpleMemoryCertStore(CertStoreParameters params); @Override Collection<? extends CRL> engineGetCRLs(CRLSelector selector); @Override Collection<? extends Certificate> engineGetCertificates(CertSelector selector); }
SimpleMemoryCertStore extends CertStoreSpi { @Override public Collection<? extends Certificate> engineGetCertificates(CertSelector selector) throws CertStoreException { List<X509Certificate> l = new LinkedList<X509Certificate>(); X509CertSelector select = (X509CertSelector) selector; for (X509Certificate cert : certStore) { if (selector.match(cert)) { l.add(cert); } } return l; } SimpleMemoryCertStore(CertStoreParameters params); @Override Collection<? extends CRL> engineGetCRLs(CRLSelector selector); @Override Collection<? extends Certificate> engineGetCertificates(CertSelector selector);  }