public static Set<TrustAnchor> toTrustAnchors( Collection<X509Certificate> certificates )
    {
        if ( certificates == null )
        {
            return Collections.emptySet();
        }

        return toTrustAnchors( certificates.toArray( new X509Certificate[ certificates.size() ] ) );
    }
Transforms a collection of certificates into TrustAnchor instances.

This method does not set the nameConstraints parameter of the generated TrustAnchors.

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 An array 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