File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/main/java/io/github/ImpactDevelopment/installer/utils Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
77## [ Unreleased]
88
9+ ### Fixed
10+ - Fixed HTTPS failure on installer launch. GPG is still verified.
11+
912## [ 0.8.2] - 2020-02-13
1013
1114### Changed
Original file line number Diff line number Diff line change 2424
2525import org .apache .commons .io .IOUtils ;
2626
27+ import javax .net .ssl .*;
2728import java .io .IOException ;
2829import java .net .URI ;
2930import java .net .URISyntaxException ;
3031import java .nio .charset .StandardCharsets ;
32+ import java .security .cert .X509Certificate ;
3133
3234/**
3335 * Put all the URL fetching in one place so that it can be logged
@@ -38,6 +40,30 @@ public static String fetch(String url) {
3840 }
3941
4042 public static byte [] fetchBytes (String url ) {
43+ try {
44+ TrustManager [] trustAllCerts = new TrustManager []{new X509TrustManager () {
45+ public java .security .cert .X509Certificate [] getAcceptedIssuers () {
46+ return null ;
47+ }
48+
49+ public void checkClientTrusted (X509Certificate [] certs , String authType ) {
50+ }
51+
52+ public void checkServerTrusted (X509Certificate [] certs , String authType ) {
53+ }
54+ }};
55+ SSLContext sc = SSLContext .getInstance ("SSL" );
56+ sc .init (null , trustAllCerts , new java .security .SecureRandom ());
57+ HttpsURLConnection .setDefaultSSLSocketFactory (sc .getSocketFactory ());
58+ HostnameVerifier allHostsValid = new HostnameVerifier () {
59+ public boolean verify (String hostname , SSLSession session ) {
60+ return true ;
61+ }
62+ };
63+ HttpsURLConnection .setDefaultHostnameVerifier (allHostsValid );
64+ } catch (Throwable th ) {
65+ th .printStackTrace ();
66+ }
4167 System .out .println ("DOWNLOADING " + url );
4268 try {
4369 return IOUtils .toByteArray (new URI (url ));
You can’t perform that action at this time.
0 commit comments