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

org.bouncycastle.jsse.provider.ProvSSLSocketFactory Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for the TLS, including a JSSE provider. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.

There is a newer version: 2.0.19
Show newest version
package org.bouncycastle.jsse.provider;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

import javax.net.ssl.SSLSocketFactory;

class ProvSSLSocketFactory
    extends SSLSocketFactory
{
    protected final ContextData contextData;

    ProvSSLSocketFactory(ContextData contextData)
    {
        super();

        this.contextData = contextData;
    }

    @Override
    public Socket createSocket() throws IOException
    {
        return SSLSocketUtil.create(contextData);
    }

    @Override
    public Socket createSocket(InetAddress host, int port) throws IOException
    {
        return SSLSocketUtil.create(contextData, host, port);
    }

    @Override
    public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
        throws IOException
    {
        return SSLSocketUtil.create(contextData, address, port, localAddress, localPort);
    }

    @Override
    public Socket createSocket(String host, int port) throws IOException, UnknownHostException
    {
        return SSLSocketUtil.create(contextData, host, port);
    }

    @Override
    public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
        throws IOException, UnknownHostException
    {
        return SSLSocketUtil.create(contextData, host, port, localHost, localPort);
    }

    @Override
    public Socket createSocket(Socket s, InputStream consumed, boolean autoClose) throws IOException
    {
        return SSLSocketUtil.create(contextData, s, consumed, autoClose);
    }

    @Override
    public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException
    {
        return SSLSocketUtil.create(contextData, s, host, port, autoClose);
    }

    @Override
    public String[] getDefaultCipherSuites()
    {
        return contextData.getContext().getDefaultCipherSuites(true);
    }

    @Override
    public String[] getSupportedCipherSuites()
    {
        return contextData.getContext().getSupportedCipherSuites();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy