diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-25 19:54:43 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-25 19:54:43 +0900 |
commit | 28ac4a24e29a3eec1b628c6529498be1ddb39a6b (patch) | |
tree | e18c548c3842e336278a84254da53274c253fc07 | |
parent | 01dfac23ce5a888009b6a865d023a9e094726780 (diff) | |
download | Skyblock-Dungeons-Guide-28ac4a24e29a3eec1b628c6529498be1ddb39a6b.tar.gz Skyblock-Dungeons-Guide-28ac4a24e29a3eec1b628c6529498be1ddb39a6b.tar.bz2 Skyblock-Dungeons-Guide-28ac4a24e29a3eec1b628c6529498be1ddb39a6b.zip |
- Make let's encrypt fail gracefully
Signed-off-by: syeyoung <cyoung06@naver.com>
-rw-r--r-- | loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LetsEncrypt.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LetsEncrypt.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LetsEncrypt.java index 7d75d571..a364a4c7 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LetsEncrypt.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/LetsEncrypt.java @@ -18,6 +18,9 @@ package kr.syeyoung.dungeonsguide.launcher; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManagerFactory; @@ -37,6 +40,8 @@ import java.util.Objects; // Smh minecraft default launcher letsencrypt public class LetsEncrypt { + private static final Logger logger = LogManager.getLogger("DG-LetsEncrypt"); + public static SSLSocketFactory LETS_ENCRYPT; static { @@ -53,6 +58,8 @@ public class LetsEncrypt { String keyStorePassword = System.getProperty( "javax.net.ssl.trustStorePassword", "" ); // You might ask, "THE DEFAULT PASSWORD IS changeit". But in fact, just loading keystore does not require a key!! https://stackoverflow.com/a/42363257 String keyStoreType = System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType()); + logger.info("Keystore: "+keyStoreLocation+" / Type: "+keyStoreType); + char[] charArr = keyStorePassword.isEmpty() ? null : keyStorePassword.toCharArray(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); @@ -65,6 +72,9 @@ public class LetsEncrypt { try (InputStream caInput = LetsEncrypt.class.getResourceAsStream("/isrgrootx1.der")) { Certificate crt = cf.generateCertificate(caInput); keyStore.setCertificateEntry("ISRGRootX1", crt); + } catch (Throwable e) { + logger.error("Failed to load up let's encrypt certificate, hoping whatever the keystore I loaded has it."); + e.printStackTrace(); } } |