public static SslContext createSslContextForClient()

in common/src/main/java/org/apache/omid/tls/X509Util.java [66:94]


    public static SslContext createSslContextForClient(String keyStoreLocation, char[] keyStorePassword,
                                                       String keyStoreType, String trustStoreLocation, char[] trustStorePassword, String trustStoreType,
                                                       boolean sslCrlEnabled, boolean sslOcspEnabled, String enabledProtocols, String cipherSuites, String tlsConfigProtocols)
            throws X509Exception, IOException {

        SslContextBuilder sslContextBuilder = SslContextBuilder.forClient();

        if (keyStoreLocation.isEmpty()) {
            LOG.warn("keyStoreLocation is not specified");
        } else {
            sslContextBuilder
                    .keyManager(createKeyManager(keyStoreLocation, keyStorePassword, keyStoreType));
        }

        if (trustStoreLocation.isEmpty()) {
            LOG.warn("trustStoreLocation is not specified");
        } else {
            sslContextBuilder.trustManager(createTrustManager(trustStoreLocation, trustStorePassword,
                    trustStoreType, sslCrlEnabled, sslOcspEnabled));
        }

        sslContextBuilder.enableOcsp(sslOcspEnabled);
        sslContextBuilder.protocols(getEnabledProtocols(enabledProtocols, tlsConfigProtocols));
        if (cipherSuites != null && !cipherSuites.isEmpty()) {
            sslContextBuilder.ciphers(Arrays.asList(cipherSuites.split(",")));
        }

        return sslContextBuilder.build();
    }