导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - JuspaySSLSocketFactory.java 源代码

正在查看: bbinstant v6.24.0 应用的 JuspaySSLSocketFactory.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.juspay.hypersdk.utils.network;

import java.net.InetAddress;
import java.net.Socket;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;

public class JuspaySSLSocketFactory extends SSLSocketFactory {
    private final SSLSocketFactory delegate;

    public JuspaySSLSocketFactory() {
        SSLContext sSLContext = SSLContext.getInstance("TLS");
        sSLContext.init(null, null, null);
        this.delegate = sSLContext.getSocketFactory();
    }

    private Socket enableTLSOnSocket(Socket socket) {
        if (socket instanceof SSLSocket) {
            ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"});
        }
        return socket;
    }

    @Override
    public Socket createSocket() {
        return enableTLSOnSocket(this.delegate.createSocket());
    }

    @Override
    public String[] getDefaultCipherSuites() {
        return this.delegate.getDefaultCipherSuites();
    }

    @Override
    public String[] getSupportedCipherSuites() {
        return this.delegate.getSupportedCipherSuites();
    }

    @Override
    public Socket createSocket(String str, int i2) {
        return enableTLSOnSocket(this.delegate.createSocket(str, i2));
    }

    @Override
    public Socket createSocket(String str, int i2, InetAddress inetAddress, int i3) {
        return enableTLSOnSocket(this.delegate.createSocket(str, i2, inetAddress, i3));
    }

    @Override
    public Socket createSocket(InetAddress inetAddress, int i2) {
        return enableTLSOnSocket(this.delegate.createSocket(inetAddress, i2));
    }

    @Override
    public Socket createSocket(InetAddress inetAddress, int i2, InetAddress inetAddress2, int i3) {
        return enableTLSOnSocket(this.delegate.createSocket(inetAddress, i2, inetAddress2, i3));
    }

    @Override
    public Socket createSocket(Socket socket, String str, int i2, boolean z) {
        return enableTLSOnSocket(this.delegate.createSocket(socket, str, i2, z));
    }
}