public class MySSLSocketFactory
extends org.apache.http.conn.ssl.SSLSocketFactory
Warning! This omits SSL certificate validation on every device, use with caution
| 构造器和说明 |
|---|
MySSLSocketFactory(java.security.KeyStore truststore)
Creates a new SSL Socket Factory with the given KeyStore.
|
| 限定符和类型 | 方法和说明 |
|---|---|
java.net.Socket |
createSocket() |
java.net.Socket |
createSocket(java.net.Socket socket,
java.lang.String host,
int port,
boolean autoClose) |
void |
fixHttpsURLConnection()
Makes HttpsURLConnection trusts a set of certificates specified by the KeyStore
|
static org.apache.http.conn.ssl.SSLSocketFactory |
getFixedSocketFactory()
Returns a SSlSocketFactory which trusts all certificates
|
static java.security.KeyStore |
getKeystore()
Gets a Default KeyStore
|
static java.security.KeyStore |
getKeystoreOfCA(java.io.InputStream cert)
Gets a KeyStore containing the Certificate
|
static DefaultHttpClient |
getNewHttpClient(java.security.KeyStore keyStore)
Gets a DefaultHttpClient which trusts a set of certificates specified by the KeyStore
|
public MySSLSocketFactory(java.security.KeyStore truststore)
throws java.security.NoSuchAlgorithmException,
java.security.KeyManagementException,
java.security.KeyStoreException,
java.security.UnrecoverableKeyException
truststore - A KeyStore to create the SSL Socket Factory in context ofjava.security.NoSuchAlgorithmException - NoSuchAlgorithmExceptionjava.security.KeyManagementException - KeyManagementExceptionjava.security.KeyStoreException - KeyStoreExceptionjava.security.UnrecoverableKeyException - UnrecoverableKeyExceptionpublic java.net.Socket createSocket(java.net.Socket socket,
java.lang.String host,
int port,
boolean autoClose)
throws java.io.IOException
createSocket 在接口中 org.apache.http.conn.scheme.LayeredSocketFactorycreateSocket 在类中 org.apache.http.conn.ssl.SSLSocketFactoryjava.io.IOExceptionpublic java.net.Socket createSocket()
throws java.io.IOException
createSocket 在接口中 org.apache.http.conn.scheme.SocketFactorycreateSocket 在类中 org.apache.http.conn.ssl.SSLSocketFactoryjava.io.IOExceptionpublic void fixHttpsURLConnection()
public static java.security.KeyStore getKeystoreOfCA(java.io.InputStream cert)
cert - InputStream of the Certificatepublic static java.security.KeyStore getKeystore()
public static org.apache.http.conn.ssl.SSLSocketFactory getFixedSocketFactory()
public static DefaultHttpClient getNewHttpClient(java.security.KeyStore keyStore)
keyStore - custom provided KeyStore instance