正在查看: Oolka v2.4.42 应用的 TLSSocketFactory.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 TLSSocketFactory.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.singular.sdk.internal;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
public class TLSSocketFactory extends SSLSocketFactory {
private SSLSocketFactory internalSSLSocketFactory;
public TLSSocketFactory() throws KeyManagementException, NoSuchAlgorithmException {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, null, null);
this.internalSSLSocketFactory = sSLContext.getSocketFactory();
}
private Socket enableTLSOnSocket(Socket socket) {
if (socket != null && (socket instanceof SSLSocket)) {
((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.2"});
}
return socket;
}
@Override
public Socket createSocket() throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket());
}
@Override
public String[] getDefaultCipherSuites() {
return this.internalSSLSocketFactory.getDefaultCipherSuites();
}
@Override
public String[] getSupportedCipherSuites() {
return this.internalSSLSocketFactory.getSupportedCipherSuites();
}
@Override
public Socket createSocket(Socket socket, String str, int i, boolean z) throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(socket, str, i, z));
}
@Override
public Socket createSocket(String str, int i) throws IOException, UnknownHostException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(str, i));
}
@Override
public Socket createSocket(String str, int i, InetAddress inetAddress, int i2) throws IOException, UnknownHostException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(str, i, inetAddress, i2));
}
@Override
public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(inetAddress, i));
}
@Override
public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress2, int i2) throws IOException {
return enableTLSOnSocket(this.internalSSLSocketFactory.createSocket(inetAddress, i, inetAddress2, i2));
}
}