public static Set<X509Certificate> filterValid( Collection<X509Certificate> certificates )
    {
        if ( certificates == null )
        {
            return Collections.emptySet();
        }
        return filterValid( certificates.toArray( new X509Certificate[ certificates.size() ] ) );
    }
Returns all valid certificates from the provided input, where validity references the notBefore and notAfter
dates of each certificate.

This method returns all certificates from the input for which {@link X509Certificate#checkValidity()} returns
true.

The return value of this method is a Set, which means that duplicate certificates in the input are implicitly
being removed from the result.

@param certificates A Collection of certificates (possibly empty, possibly null).
@return A Set of valid certificates (possibly empty, but never null).
xmppserver/src/main/java/org/jivesoftware/openfire/keystore/CertificateUtils.java