Skip to content

Commit

Permalink
Try to fix "No SSL cert found bind exception"
Browse files Browse the repository at this point in the history
  • Loading branch information
memetrollsXD committed Apr 24, 2022
1 parent b150818 commit e29b674
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,20 @@ public void start() throws Exception {
SSLContext sslContext = SSLContext.getInstance("TLS");
try (FileInputStream fis = new FileInputStream(Grasscutter.getConfig().getDispatchOptions().KeystorePath)) {
char[] keystorePassword = Grasscutter.getConfig().getDispatchOptions().KeystorePassword.toCharArray();
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(fis, keystorePassword);
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, keystorePassword);

try {
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(fis, keystorePassword);
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, keystorePassword);
} catch (Exception e) {
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(fis, "123456");
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, "123456");
} catch (Exception e) {
Grasscutter.getLogger().warn("[Dispatch] Error while loading keystore!");
}

sslContext.init(kmf.getKeyManagers(), null, null);

Expand Down

0 comments on commit e29b674

Please sign in to comment.