feat: remove forceIgnoreHttpsCertificate for security

This commit is contained in:
33 committed 2023-12-15 17:39:36 +08:00
1 parent 0ffa9ef137
commit d2772697f3
3 files changed
+1 -31

No files matched your search

@@ -24,7 +24,6 @@ public class Config {
//Function
public boolean enableDynamicSkull = true;
public boolean enableTransparentSkin = true;
public boolean forceIgnoreHttpsCertificate = false;
public boolean forceLoadAllTextures = true;
public boolean enableCape = true;
public int threadPoolSize = 8;
@@ -76,8 +75,6 @@ public class Config {
config.updateLoadlist();
config.initLocalFolder();
config.threadPoolSize = Math.max(config.threadPoolSize, 1);
if (config.forceIgnoreHttpsCertificate)
HttpUtil0.ignoreHttpsCertificate();
if (config.enableCacheAutoClean && !config.enableLocalProfileCache) {
try {
FileUtils.deleteDirectory(HttpRequestUtil.CACHE_DIR);
@@ -20,33 +20,6 @@ public class HttpUtil0 {
return url != null && !url.startsWith("http://") && !url.startsWith("https://");
}
//From: http://blog.csdn.net/xiyushiyi/article/details/46685387
public static void ignoreHttpsCertificate(){
HostnameVerifier doNotVerify = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[] {};
}
public void checkClientTrusted(X509Certificate[] chain, String authType){}
public void checkServerTrusted(X509Certificate[] chain, String authType){}
}};
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
//HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultSSLSocketFactory(new SSLSocketFactoryFacade());
HttpsURLConnection.setDefaultHostnameVerifier(doNotVerify);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String parseAddress(String address) {
if(StringUtils.isEmpty(address))
return null;
+1 -1
View File
@@ -1,3 +1,3 @@
name=CustomSkinLoader
group=customskinloader
version=14.19
version=14.19.1