List of usage examples for java.security.cert CRLSelector match
boolean match(CRL crl);
From source file:mitm.common.security.crlstore.dao.X509CRLStoreDAOHibernate.java
@Override public Collection<X509CRL> getCRLs(CRLSelector crlSelector, Integer firstResult, Integer maxResults) throws CRLStoreException { Collection<X509CRL> foundCRLs = new LinkedList<X509CRL>(); CloseableIterator<X509CRL> iterator = getCRLIterator(crlSelector, firstResult, maxResults); try {/*w w w . ja v a2s. co m*/ try { while (iterator.hasNext()) { X509CRL crl = iterator.next(); if (crl != null && (crlSelector == null || crlSelector.match(crl))) { foundCRLs.add(crl); } } } finally { /* we must close the iterator */ iterator.close(); } } catch (CloseableIteratorException e) { throw new CRLStoreException(e); } return foundCRLs; }
From source file:org.globus.gsi.stores.ResourceCertStore.java
/** * Returns a <code>Collection</code> of <code>CRL</code>s that match the * specified selector. If no <code>CRL</code>s match the selector, an empty * <code>Collection</code> will be returned. * <p/>//w w w .j a v a 2 s.c o m * For some <code>CertStore</code> types, the resulting * <code>Collection</code> may not contain <b>all</b> of the * <code>CRL</code>s that match the selector. For instance, an LDAP * <code>CertStore</code> may not search all entries in the directory. * Instead, it may just search entries that are likely to contain the * <code>CRL</code>s it is looking for. * <p/> * Some <code>CertStore</code> implementations (especially LDAP * <code>CertStore</code>s) may throw a <code>CertStoreException</code> * unless a non-null <code>CRLSelector</code> is provided that includes * specific criteria that can be used to find the CRLs. Issuer names and/or * the certificate to be checked are especially useful. * * @param selector * A <code>CRLSelector</code> used to select which * <code>CRL</code>s should be returned. Specify * <code>null</code> to return all <code>CRL</code>s (if * supported). * @return A <code>Collection</code> of <code>CRL</code>s that match the * specified selector (never <code>null</code>) * @throws java.security.cert.CertStoreException * if an exception occurs */ public Collection<? extends CRL> engineGetCRLs(CRLSelector selector) throws CertStoreException { if (selector != null && !(selector instanceof X509CRLSelector)) { throw new IllegalArgumentException(); } if (crlDelegate.getCollection() == null) { return new Vector<X509CRL>(); } // Given that we always only use subject, how can we improve performance // here. Custom if (selector == null) { return crlDelegate.getCollection(); } else { Vector<X509CRL> certSet = new Vector<X509CRL>(); for (X509CRL crl : crlDelegate.getCollection()) { if (selector.match(crl)) { certSet.add(crl); } } return certSet; } }