|
|
|
@ -107,7 +107,7 @@ public final class SSLSocketFactoryUtils { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
//获得服务器端证书
|
|
|
|
|
TrustManager[] turstManager = getTurstManager(certificates); |
|
|
|
|
TrustManager[] turstManager = getTrustManager(certificates); |
|
|
|
|
|
|
|
|
|
//初始化ssl证书库
|
|
|
|
|
try { |
|
|
|
@ -129,7 +129,7 @@ public final class SSLSocketFactoryUtils { |
|
|
|
|
* @param certificates |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static TrustManager[] getTurstManager(InputStream... certificates) { |
|
|
|
|
public static TrustManager[] getTrustManager(InputStream... certificates) { |
|
|
|
|
try { |
|
|
|
|
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); |
|
|
|
|
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); |
|
|
|
@ -161,13 +161,13 @@ public final class SSLSocketFactoryUtils { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return getTurstAllManager(); |
|
|
|
|
return getTrustAllManager(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获得信任所有服务器端证书库 |
|
|
|
|
* */ |
|
|
|
|
public static TrustManager[] getTurstAllManager() { |
|
|
|
|
public static TrustManager[] getTrustAllManager() { |
|
|
|
|
return new X509TrustManager[] {createTrustAllManager()}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|