private Optional<TrustManager[]> createTrustManagers(KeyStore keystore) throws GeneralSecurityException {
        if (!hasCaCertificateInstance() && !hasCaCertificateFile()) return Optional.empty();
        TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
        tmf.init(keystore);
        return Optional.of(tmf.getTrustManagers());
    }
BouncyCastle integration for creating a {@link SSLContext} instance from PEM encoded material

@author bjorncs
vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/SslContextBuilder.java