diff --git a/Launcher/runtime/dialog/dialog.js b/Launcher/runtime/dialog/dialog.js index f93b71e5..477220bc 100644 --- a/Launcher/runtime/dialog/dialog.js +++ b/Launcher/runtime/dialog/dialog.js @@ -146,13 +146,13 @@ function verifyLauncher(e) { LauncherRequest.update(Launcher.getConfig(), result); return; } - settings.lastSign = result.sign; + settings.lastSign = result.digest; processing.resetOverlay(); // Init offline if set if (settings.offline) { initOffline(); } - overlay.show(processing.overlay, function(event) makeProfilesRequest(function(result) { + overlay.swap(0, processing.overlay, function(event) makeProfilesRequest(function(result) { settings.lastProfiles = result.profiles; // Update profiles list and hide overlay updateProfilesList(result.profiles); @@ -161,7 +161,7 @@ function verifyLauncher(e) { goAuth(null); } }); - }); + })); })); diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java index 5e9b26a4..37794b35 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -81,12 +81,12 @@ public static final class Params extends StreamObject { public final int width; @LauncherAPI public final int height; - private final byte[] launcherSign; + private final byte[] launcherDigest; @LauncherAPI - public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile pp, String accessToken, + public Params(byte[] launcherDigest, Path assetDir, Path clientDir, PlayerProfile pp, String accessToken, boolean autoEnter, boolean fullScreen, int ram, int width, int height) { - this.launcherSign = launcherSign.clone(); + this.launcherDigest = launcherDigest.clone(); this.updateOptional = new HashSet<>(); for(ClientProfile.MarkedString s : Launcher.profile.getOptional()) { @@ -107,7 +107,7 @@ public Params(byte[] launcherSign, Path assetDir, Path clientDir, PlayerProfile @LauncherAPI public Params(HInput input) throws Exception { - launcherSign = input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH); + launcherDigest = input.readByteArray(0); // Client paths assetDir = IOHelper.toPath(input.readString(0)); clientDir = IOHelper.toPath(input.readString(0)); @@ -131,7 +131,7 @@ public Params(HInput input) throws Exception { @Override public void write(HOutput output) throws IOException { - output.writeByteArray(launcherSign, -SecurityHelper.RSA_KEY_LENGTH); + output.writeByteArray(launcherDigest, 0); // Client paths output.writeString(assetDir.toString(), 0); output.writeString(clientDir.toString(), 0); @@ -437,7 +437,8 @@ public static void main(String... args) throws Throwable { Launcher.modulesManager.initModules(); // Verify ClientLauncher sign and classpath LogHelper.debug("Verifying ClientLauncher sign and classpath"); - SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherSign, publicKey); + //TODO: GO TO DIGEST + //SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, publicKey); LinkedList classPath = resolveClassPathList(params.clientDir, profile.object.getClassPath()); for (Path classpathURL : classPath) { LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString()); @@ -476,7 +477,7 @@ public void launchLocal(SignedObjectHolder assetHDir, SignedObjectHol SignedObjectHolder profile, Params params) throws Throwable { RSAPublicKey publicKey = Launcher.getConfig().publicKey; LogHelper.debug("Verifying ClientLauncher sign and classpath"); - SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherSign, publicKey); + SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, publicKey); LinkedList classPath = resolveClassPathList(params.clientDir, profile.object.getClassPath()); for (Path classpathURL : classPath) { LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString()); diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java b/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java index 13035952..000087e5 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/FunctionalBridge.java @@ -35,8 +35,9 @@ public LegacyLauncherRequest.Result offlineLauncherRequest() throws IOException, } // Verify launcher signature - SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, - settings.lastSign, Launcher.getConfig().publicKey); + //TODO: TO DIGEST + //SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, + // settings.lastSign, Launcher.getConfig().publicKey); // Return last sign and profiles return new LegacyLauncherRequest.Result(null,settings.lastSign,settings.lastProfiles); diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/LauncherSettings.java b/Launcher/src/main/java/ru/gravit/launcher/client/LauncherSettings.java index 643c4b01..14bd2496 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/LauncherSettings.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/LauncherSettings.java @@ -100,7 +100,7 @@ public void read(HInput input) throws IOException, SignatureException // Offline cache RSAPublicKey publicKey = Launcher.getConfig().publicKey; - lastSign = input.readBoolean() ? input.readByteArray(-SecurityHelper.RSA_KEY_LENGTH) : null; + lastSign = input.readBoolean() ? input.readByteArray(0) : null; lastProfiles.clear(); int lastProfilesCount = input.readLength(0); for (int i = 0; i < lastProfilesCount; i++) { @@ -141,7 +141,7 @@ public void write(HOutput output) throws IOException { // Offline cache output.writeBoolean(lastSign != null); if (lastSign != null) { - output.writeByteArray(lastSign, -SecurityHelper.RSA_KEY_LENGTH); + output.writeByteArray(lastSign, 0); } output.writeLength(lastProfiles.size(), 0); for (SignedObjectHolder profile : lastProfiles) {