diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-16 17:51:21 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-16 17:51:21 +0900 |
commit | e6f83a23279ba7f2254efa4b49074fbc49bfb054 (patch) | |
tree | efea89836c3376ff1edbe3fdb22c6d95d3221b2c /src/main/java/kr/syeyoung/dungeonsguide/b.java | |
parent | 3305b6493ca089226c5ad194068231c8e1605bcf (diff) | |
download | Skyblock-Dungeons-Guide-e6f83a23279ba7f2254efa4b49074fbc49bfb054.tar.gz Skyblock-Dungeons-Guide-e6f83a23279ba7f2254efa4b49074fbc49bfb054.tar.bz2 Skyblock-Dungeons-Guide-e6f83a23279ba7f2254efa4b49074fbc49bfb054.zip |
asd
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/b.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/b.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/b.java b/src/main/java/kr/syeyoung/dungeonsguide/b.java index d0422526..032d8e4e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/b.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/b.java @@ -8,6 +8,7 @@ import com.mojang.authlib.minecraft.MinecraftSessionService; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.util.Session; +import org.apache.commons.codec.binary.Base64; import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; @@ -51,8 +52,8 @@ public class b { String c = a(a.getProfile()); MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService(); JsonObject d = a(c); - String hash = a(DatatypeConverter.parseBase64Binary(d.get("sharedSecret").getAsString()), - DatatypeConverter.parseBase64Binary(d.get("publicKey").getAsString())); + String hash = a(Base64.decodeBase64(d.get("sharedSecret").getAsString()), + Base64.decodeBase64(d.get("publicKey").getAsString())); yggdrasilMinecraftSessionService.joinServer(a.getProfile(), b, hash); this.b = a(c, this.a.getPublic()); b(this.b); @@ -61,7 +62,7 @@ public class b { public JsonObject a(String c) { String a = c.split("\\.")[1].replace("+", "-").replace("/", "_"); - String b = new String(DatatypeConverter.parseBase64Binary(a)); + String b = new String(Base64.decodeBase64(a)); // padding return (JsonObject) new JsonParser().parse(b); } @@ -89,7 +90,7 @@ public class b { c.setDoInput(true); c.setDoOutput(true); - c.getOutputStream().write(("{\"jwt\":\""+a+"\",\"publicKey\":\""+DatatypeConverter.printBase64Binary(b.getEncoded())+"\"}").getBytes()); + c.getOutputStream().write(("{\"jwt\":\""+a+"\",\"publicKey\":\""+Base64.encodeBase64URLSafeString(b.getEncoded())+"\"}").getBytes()); InputStreamReader d = new InputStreamReader(c.getInputStream()); JsonObject e = (JsonObject) new JsonParser().parse(d); if (!"ok".equals(e.get("status").getAsString())) { |