MCPcopy Index your code
hub / github.com/0x727/DropLabTools / getTrust

Method getTrust

src/main/java/com/droplab/Utils/HttpUtils.java:388–411  ·  view source on GitHub ↗

获取服务器信任

()

Source from the content-addressed store, hash-verified

386 * 获取服务器信任
387 */
388 private static void getTrust() {
389 try {
390 HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
391
392 public boolean verify(String hostname, SSLSession session) {
393 return true;
394 }
395 });
396 SSLContext context = SSLContext.getInstance("TLS");
397 context.init(null, new X509TrustManager[] { new X509TrustManager() {
398
399 public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
400
401 public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
402
403 public X509Certificate[] getAcceptedIssuers() {
404 return new X509Certificate[0];
405 }
406 } }, new SecureRandom());
407 HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
408 } catch (Exception e) {
409 e.printStackTrace();
410 }
411 }
412
413}
414

Callers 2

getMethod · 0.95
doPostRequestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected