All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.altindag.sslcontext.util.ApacheSslContextUtils Maven / Gradle / Ivy

Go to download

High level library to configure a SSLContext and other properties to enable SSL/TLS connection

There is a newer version: 5.4.0
Show newest version
package nl.altindag.sslcontext.util;

import nl.altindag.sslcontext.SSLFactory;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;

import java.util.Objects;

public final class ApacheSslContextUtils {

    private ApacheSslContextUtils() {}

    public static LayeredConnectionSocketFactory toLayeredConnectionSocketFactory(SSLFactory sslFactory) {
        Objects.requireNonNull(sslFactory.getSslContext());

        return new SSLConnectionSocketFactory(
                sslFactory.getSslContext(),
                sslFactory.getSslContext().getSupportedSSLParameters().getProtocols(),
                sslFactory.getSslContext().getSupportedSSLParameters().getCipherSuites(),
                sslFactory.getHostnameVerifier()
        );
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy