diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/SignerJar.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/SignerJar.java index b0d525cb..5da3d5e0 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/SignerJar.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/SignerJar.java @@ -41,8 +41,8 @@ public class SignerJar implements AutoCloseable { private static final String MANIFEST_FN = "META-INF/MANIFEST.MF"; - private static final String SIG_FN = "META-INF/SIGNUMO.SF"; - private static final String SIG_RSA_FN = "META-INF/SIGNUMO.RSA"; + private final String SIG_FN; + private final String SIG_KEY_FN; private static final String DIGEST_HASH = SignHelper.hashFunctionName + "-Digest"; private final ZipOutputStream zos; @@ -56,12 +56,14 @@ public class SignerJar implements AutoCloseable { private final Map sectionDigests; private final Supplier gen; - public SignerJar(ZipOutputStream out, Supplier gen) { + public SignerJar(ZipOutputStream out, Supplier gen, String sig_fn, String sig_key_fn) { zos = out; this.gen = gen; manifestAttributes = new LinkedHashMap<>(); fileDigests = new LinkedHashMap<>(); sectionDigests = new LinkedHashMap<>(); + SIG_FN = "META-INF/".concat(sig_fn); + SIG_KEY_FN = "META-INF/".concat(sig_key_fn); } /** @@ -273,7 +275,7 @@ private byte[] writeSigFile() throws IOException { * @throws RuntimeException if the signing failed */ private void writeSignature(byte[] sigFile) throws IOException { - zos.putNextEntry(IOHelper.newZipEntry(SIG_RSA_FN)); + zos.putNextEntry(IOHelper.newZipEntry(SIG_KEY_FN)); try { byte[] signature = signSigFile(sigFile); zos.write(signature); 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 8746b342..f1091cc7 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 @@ -42,7 +42,8 @@ public String getName() { 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)); + try (SignerJar output = new SignerJar(new ZipOutputStream(IOHelper.newOutput(toRet)), () -> this.gen(c), + config.manifestFileSfName, config.manifestFileSfName); 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(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 27b010dd..a4f29d46 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -233,6 +233,8 @@ public static class JarSignerConf { public String keyStorePass = "mypass"; public String keyAlias = "myname"; public String keyPass = "mypass"; + public String manifestFileName = "SIGNUMO.RSA"; + public String manifestFileSfName = "SIGNUMO.SF"; public String signAlgo = "SHA256WITHRSA"; }