aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-08 15:29:41 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-12-08 15:29:41 +0900
commitb06446766ce172df4187f05e6359f2f55e658b79 (patch)
treeb69d96a6b346987d81c09018f10976c84987606d
parent87e89fd42ca44400a3d3d3d5477cd1525b24d91a (diff)
downloadSkyblock-Dungeons-Guide-b06446766ce172df4187f05e6359f2f55e658b79.tar.gz
Skyblock-Dungeons-Guide-b06446766ce172df4187f05e6359f2f55e658b79.tar.bz2
Skyblock-Dungeons-Guide-b06446766ce172df4187f05e6359f2f55e658b79.zip
bug fixes
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java10
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/NetworkClassLoader.java8
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java1
3 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
index 15b238c6..e41fadbe 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/Authenticator.java
@@ -56,8 +56,8 @@ public class Authenticator {
String hash = calculateAuthHash(DatatypeConverter.parseBase64Binary(jwt2.getClaim("sharedSecret").asString()),
DatatypeConverter.parseBase64Binary(jwt2.getClaim("publicKey").asString()));
yggdrasilMinecraftSessionService.joinServer(session.getProfile(), token, hash);
- token = requestAuth2(jwt, keyPair.getPublic());
- return token;
+ this.token = requestAuth2(jwt, keyPair.getPublic());
+ return this.token;
}
private String requestAuth(GameProfile profile) throws IOException {
@@ -115,11 +115,13 @@ public class Authenticator {
((bytes[1] & 0xFF) << 16) |
((bytes[2] & 0xFF) << 8 ) |
((bytes[3] & 0xFF));
-
+ System.out.println(len);
+ while(inputStream.available() < len);
byte[] pubKey = new byte[len];
inputStream.read(pubKey);
+ System.out.println(DatatypeConverter.printBase64Binary(pubKey));
- Cipher cipher = Cipher.getInstance("RSA");
+ Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
byte[] byteEncrypted = pubKey;
cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate());
byte[] bytePlain = cipher.doFinal(byteEncrypted);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/NetworkClassLoader.java b/src/main/java/kr/syeyoung/dungeonsguide/NetworkClassLoader.java
index 564eeb11..dc440405 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/NetworkClassLoader.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/NetworkClassLoader.java
@@ -48,9 +48,11 @@ public class NetworkClassLoader extends ClassLoader {
InputStream inputStream = authenticator.getInputStream(fileName.replace('.', '/')+ ".class");
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
int nextValue = 0;
- while ( (nextValue = inputStream.read()) != -1 ) {
- byteStream.write(nextValue);
- }
+ try {
+ while ( (nextValue = inputStream.read()) != -1 ) {
+ byteStream.write(nextValue);
+ }
+ } catch (Exception e) {}
buffer = byteStream.toByteArray();
return buffer;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java
index 383aea08..3119311a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java
@@ -1,6 +1,5 @@
package kr.syeyoung.dungeonsguide.dungeon.roomfinder;
-import jdk.internal.util.xml.impl.Input;
import kr.syeyoung.dungeonsguide.Authenticator;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo;