private static Collection < X509Certificate > getMatchingCerts ( Collection < X509Certificate > certs , CertSelector selector ) { // if selector not specified, all certs match if ( selector == null ) { return certs ; } List < X509Certificate > matchedCerts = new ArrayList <> ( certs . size ( ) ) ; for ( X509Certificate cert : certs ) { if ( selector . match ( cert ) ) { matchedCerts . add ( cert ) ; } } return matchedCerts ; }
Iterates over the specified Collection of X509Certificates and returns only those that match the criteria specified in the CertSelector .