public static TrustManagerFactory loadTrustManagerFactory(
            final String trustStoreFormat,
            final Resource trustStore,
            final String trustStorePassword)
            throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {

        final KeyStore ks = loadKeyStore(trustStoreFormat, trustStore, trustStorePassword);
        final String trustManagerAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
        final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(trustManagerAlgorithm);
        trustManagerFactory.init(ks);
        return trustManagerFactory;
    }
Creates a new {@link TrustManagerFactory} from the given {@link KeyStore} {@link Resource}.

@param trustStoreFormat The format of the truststore.
@param trustStore The resource containing the truststore.
@param trustStorePassword The password for the truststore. May be empty or null.
@return The newly created KeyManagerFactory.
@throws KeyStoreException If the keystore format isn't supported.
@throws IOException If there is an I/O or format problem with the keystore data, if a password is required but
        not given, or if the given password was incorrect. If the error is due to a wrong password, the
        {@link Throwable#getCause cause} of the {@code IOException} should be an
        {@code UnrecoverableKeyException}
@throws NoSuchAlgorithmException If the algorithm used to check the integrity of the keystore cannot be found
@throws CertificateException If any of the certificates in the keystore could not be loaded
grpc-common-spring-boot/src/main/java/net/devh/boot/grpc/common/security/KeyStoreUtils.java