public static SslContext createSslContextForServer()

in common/src/main/java/org/apache/omid/tls/X509Util.java [96:125]


    public static SslContext createSslContextForServer(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 {

        if (keyStoreLocation.isEmpty()) {
            throw new SSLContextException(
                    "keyStoreLocation is required for SSL server: ");
        }

        SslContextBuilder sslContextBuilder;

        sslContextBuilder = SslContextBuilder
                .forServer(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();
    }