mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-05 03:47:56 +00:00
Added version check to certificate addition
This commit is contained in:
@@ -26,6 +26,7 @@ import io.netty.handler.traffic.GlobalTrafficShapingHandler;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.net.ssl.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.lang.System;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.URI;
|
||||
import java.security.KeyStore;
|
||||
@@ -114,6 +115,9 @@ public final class NetworkUtils
|
||||
|
||||
TrustManagerFactory tmf = null;
|
||||
try
|
||||
{
|
||||
String version = System.getProperty( "java.version" );
|
||||
if ( version.regionMatches( 0, "1.8.0_", 0, 6 ) && version.length() == 8 ) // 1.8.0_xx (xx < 100)
|
||||
{
|
||||
Certificate ca = CertificateFactory.getInstance( "X.509" )
|
||||
.generateCertificate( new ByteArrayInputStream( letsEncryptRootCert.getBytes() ) );
|
||||
@@ -137,6 +141,11 @@ public final class NetworkUtils
|
||||
}
|
||||
|
||||
tmf = new MergedTrustManagerFactory( TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() ), x509tm );
|
||||
}
|
||||
else
|
||||
{
|
||||
tmf = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() );
|
||||
}
|
||||
tmf.init( (KeyStore) null );
|
||||
}
|
||||
catch( Exception e )
|
||||
|
Reference in New Issue
Block a user