MD5 校验值:d555a6389a0a865314e2706996812829
CustomSSLSocketFactory.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package fo.flutter.plugins.videoplayer; import gavax.net.ssl.KeyManager; import gavax.net.ssl.SSLContext; import gavax.net.ssl.SSLSocket; import gavax.net.ssl.SSLSocketFactory; import gavax.net.ssl.TrustManager; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; public class CustomSSLSocketFactory extends SSLSocketFactory { private SSLSocketFactory sslSocketFactory; public CustomSSLSocketFactory() throws KeyManagementException, NoSuchAlgorithmException { SSLContext sSLContext = SSLContext.getInstance("TLS"); sSLContext.init((KeyManager[]) null, (TrustManager[]) null, (SecureRandom) null); this.sslSocketFactory = sSLContext.getSocketFactory(); } public String[] getDefaultCipherSuites() { return this.sslSocketFactory.getDefaultCipherSuites(); } public String[] getSupportedCipherSuites() { return this.sslSocketFactory.getSupportedCipherSuites(); } public Socket createSocket() throws IOException { return enableProtocols(this.sslSocketFactory.createSocket()); } public Socket createSocket(Socket socket, String str, int i, boolean z) throws IOException { return enableProtocols(this.sslSocketFactory.createSocket(socket, str, i, z)); } public Socket createSocket(String str, int i) throws IOException { return enableProtocols(this.sslSocketFactory.createSocket(str, i)); } public Socket createSocket(String str, int i, InetAddress inetAddress, int i2) throws IOException { return enableProtocols(this.sslSocketFactory.createSocket(str, i, inetAddress, i2)); } public Socket createSocket(InetAddress inetAddress, int i) throws IOException { return enableProtocols(this.sslSocketFactory.createSocket(inetAddress, i)); } public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress2, int i2) throws IOException { return enableProtocols(this.sslSocketFactory.createSocket(inetAddress, i, inetAddress2, i2)); } private Socket enableProtocols(Socket socket) { if (socket instanceof SSLSocket) { ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}); } return socket; } }