aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;