first commit
This commit is contained in:
commit
0b134cf11f
1087 changed files with 16728 additions and 0 deletions
|
|
@ -0,0 +1,59 @@
|
|||
package com.mojang.android.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class NoCertSSLSocketFactory extends SSLSocketFactory {
|
||||
private SSLContext sslContext;
|
||||
|
||||
public NoCertSSLSocketFactory(KeyStore keyStore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
|
||||
super(keyStore);
|
||||
this.sslContext = SSLContext.getInstance("TLS");
|
||||
TrustManager tm = new X509TrustManager() { // from class: com.mojang.android.net.NoCertSSLSocketFactory.1
|
||||
@Override // javax.net.ssl.X509TrustManager
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override // javax.net.ssl.X509TrustManager
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override // javax.net.ssl.X509TrustManager
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
this.sslContext.init(null, new TrustManager[]{tm}, null);
|
||||
}
|
||||
|
||||
@Override // org.apache.http.conn.ssl.SSLSocketFactory, org.apache.http.conn.scheme.LayeredSocketFactory
|
||||
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException {
|
||||
return this.sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
|
||||
}
|
||||
|
||||
@Override // org.apache.http.conn.ssl.SSLSocketFactory, org.apache.http.conn.scheme.SocketFactory
|
||||
public Socket createSocket() throws IOException {
|
||||
return this.sslContext.getSocketFactory().createSocket();
|
||||
}
|
||||
|
||||
public static NoCertSSLSocketFactory createDefault() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, KeyManagementException, UnrecoverableKeyException {
|
||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
keyStore.load(null, null);
|
||||
NoCertSSLSocketFactory factory = new NoCertSSLSocketFactory(keyStore);
|
||||
factory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue