From e1c6775e34b01b0694fbf42d3e2ddba2804635de Mon Sep 17 00:00:00 2001 From: Gravit Date: Sun, 20 Oct 2019 22:55:36 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=9E=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?UTF-8?q?SignJarTask=20=D0=B8=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20STRIP=20=D0=B4=D0=BB=D1=8F=20=D0=B1?= =?UTF-8?q?=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/binary/tasks/AdditionalFixesApplyTask.java | 6 +++--- .../gravit/launchserver/binary/tasks/AttachJarsTask.java | 2 +- .../pro/gravit/launchserver/binary/tasks/SignJarTask.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java index 0aded026..f486e965 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AdditionalFixesApplyTask.java @@ -36,12 +36,12 @@ public String getName() { public Path process(Path inputFile) throws IOException { Path out = server.launcherBinary.nextPath("post-fixed"); try (ZipOutputStream output = new ZipOutputStream(IOHelper.newOutput(out))) { - apply(inputFile, inputFile, output, server, (e) -> false); + apply(inputFile, inputFile, output, server, (e) -> false, true); } return out; } - public static void apply(Path inputFile, Path addFile, ZipOutputStream output, LaunchServer srv, Predicate excluder) throws IOException { + public static void apply(Path inputFile, Path addFile, ZipOutputStream output, LaunchServer srv, Predicate excluder, boolean needFixes) throws IOException { try (ClassMetadataReader reader = new ClassMetadataReader()) { reader.getCp().add(new JarFile(inputFile.toFile())); List libs = srv.launcherBinary.coreLibs.stream().map(e -> { @@ -74,7 +74,7 @@ public static void apply(Path inputFile, Path addFile, ZipOutputStream output, L bytes = outputStream.toByteArray(); } try { - bytes = classFix(bytes, reader, srv.config.launcher.stripLineNumbers); + if(needFixes) bytes = classFix(bytes, reader, srv.config.launcher.stripLineNumbers); } catch (Throwable t) { LogHelper.error(t); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AttachJarsTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AttachJarsTask.java index 3ceae478..98731a6d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AttachJarsTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/AttachJarsTask.java @@ -56,7 +56,7 @@ public Path process(Path inputFile) throws IOException { private void attach(ZipOutputStream output, Path inputFile, List lst) throws IOException { for (Path p : lst) { LogHelper.debug("Attaching: " + p); - AdditionalFixesApplyTask.apply(inputFile, p, output, srv, (e) -> exclusions.stream().anyMatch(e.getName()::startsWith)); + AdditionalFixesApplyTask.apply(inputFile, p, output, srv, (e) -> exclusions.stream().anyMatch(e.getName()::startsWith), false); } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/SignJarTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/SignJarTask.java index f1091cc7..25cc1d5d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/SignJarTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/SignJarTask.java @@ -43,7 +43,7 @@ public Path process(Path inputFile) throws IOException { Path toRet = srv.launcherBinary.nextPath("signed"); KeyStore c = SignHelper.getStore(new File(config.keyStore).toPath(), config.keyStorePass, config.keyStoreType); try (SignerJar output = new SignerJar(new ZipOutputStream(IOHelper.newOutput(toRet)), () -> this.gen(c), - config.manifestFileSfName, config.manifestFileSfName); + config.manifestFileSfName, config.manifestFileName); ZipInputStream input = new ZipInputStream(IOHelper.newInput(inputFile))) { //input.getManifest().getMainAttributes().forEach((a, b) -> output.addManifestAttribute(a.toString(), b.toString())); // may not work such as after Radon. ZipEntry e = input.getNextEntry(); @@ -69,7 +69,7 @@ public boolean allowDelete() { public CMSSignedDataGenerator gen(KeyStore c) { try { return SignHelper.createSignedDataGenerator(c, - config.keyAlias, config.signAlgo, config.keyStorePass); + config.keyAlias, config.signAlgo, config.keyPass); } catch (CertificateEncodingException | UnrecoverableKeyException | KeyStoreException | OperatorCreationException | NoSuchAlgorithmException | CMSException e) { LogHelper.error(e);