Skip to content

Commit

Permalink
Release version 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ebourg committed Jan 17, 2024
1 parent 5df3a06 commit bc306a8
Show file tree
Hide file tree
Showing 46 changed files with 284 additions and 103 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,23 @@ See https://ebourg.github.io/jsign for more information.

## Changes

#### Version 5.1 (in development)
#### Version 6.0 (2024-01-17)

* Signing of APPX/MSIX packages has been implemented (thanks to Maciej Panek for the help)
* Signing of Microsoft Dynamics 365 extension packages has been implemented
* PIV cards are now supported with the new `PIV` storetype
* SafeNet eToken support has been improved with automatic PKCS#11 configuration using the new `ETOKEN` storetype
* The certificate chain in the file specified by the `certfile` parameter can now be in any order
* VBScript, JScript and PowerShell XML files without byte order marks are now parsed as Windows-1252 instead of ISO-8859-1
* The 'keystore' parameter can now be specified with the 'OPENPGP' storetype to distinguish between multiple connected devices
* The `keystore` parameter can now be specified with the `OPENPGP` storetype to distinguish between multiple connected devices
* The format detection based on the file extension is now case insensitive (contributed by Mathieu Delrocq)
* Only one call to the Google Cloud API is performed when the version of the key is specified in the alias parameter
* JVM arguments can now be passed using the `JSIGN_OPTS` environment variable
* API changes:
* New `net.jsign.jca.JsignJcaProvider` JCA security provider to be used with other signing tools such as jarsigner
* The signature can be removed by setting a null signature on the `Signable` object
* `Signable.computeDigest(MessageDigest)` has been replaced by `Signable.computeDigest(DigestAlgorithm)`
* The value of the `http.agent` system property is now appended to the user agent string set when calling REST services
* The value of the `http.agent` system property is now appended to the User-Agent header when calling REST services
* `AuthenticodeSigner` sets the security provider automatically if the keystore used is backed by a PKCS#11 token or a cloud service
* `AmazonSigningService` now supports dynamic credentials
* Upgraded BouncyCastle to 1.77
Expand Down
11 changes: 11 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
TODO

- Microsoft Office VBA macros support

https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-oshared/f80ee18c-d72f-4c3c-9ea5-a56f396322e0
https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xlsb/301bfe6b-5acc-4223-81e6-4ee2cc3fc09b
https://security.stackexchange.com/questions/256246/parse-vba-macro-digital-signature


- Verify signed files
- GUI
- Support private keys exported with PKCS#8
- Support unauthenticated blobs
- Support generating MsiDigitalSignatureEx entries when signing MSI files (requires access to the streams metadata in POI)

Resources:
- Setting up EV Code Signing on Google HSM
https://icedev.pl/posts/setting-up-ev-code-signing-google-hsm-fips-140-2/
26 changes: 13 additions & 13 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h3 id="ant">Ant Task</h3>
<p>Here is an example showing how the signing works with Ant, using a Java keystore:</p>

<pre class="prettyprint lang-xml">
&lt;taskdef name="jsign" classname="net.jsign.JsignTask" classpath="jsign-5.0.jar"/>
&lt;taskdef name="jsign" classname="net.jsign.JsignTask" classpath="jsign-6.0.jar"/>

&lt;jsign file="application.exe"
name="My Application"
Expand Down Expand Up @@ -298,7 +298,7 @@ <h3 id="maven">Maven plugin</h3>
&lt;plugin>
&lt;groupId>net.jsign&lt;/groupId>
&lt;artifactId>jsign-maven-plugin&lt;/artifactId>
&lt;version>5.0&lt;/version>
&lt;version>6.0&lt;/version>
&lt;executions>
&lt;execution>
&lt;goals>
Expand Down Expand Up @@ -385,7 +385,7 @@ <h3 id="gradle">Gradle plugin</h3>

<pre class="prettyprint lang-groovy">
plugins {
id 'net.jsign' version '5.0'
id 'net.jsign' version '6.0'
}

task sign {
Expand All @@ -405,7 +405,7 @@ <h3 id="gradle">Gradle plugin</h3>

<pre class="prettyprint lang-kotlin">
plugins {
id("net.jsign") version "5.0"
id("net.jsign") version "6.0"
}

task("sign") {
Expand All @@ -427,8 +427,8 @@ <h3 id="cli">Command Line Tool</h3>
<p>Jsign can also be used as a command line tool, packages are available for various systems:</p>

<ul>
<li><a href="https://github.com/ebourg/jsign/releases/download/5.0/jsign_5.0_all.deb">DEB package</a> (Debian/Ubuntu)</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/5.0/jsign-5.0-1.noarch.rpm">RPM package</a> (RedHat/Fedora)</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/6.0/jsign_6.0_all.deb">DEB package</a> (Debian/Ubuntu)</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0-1.noarch.rpm">RPM package</a> (RedHat/Fedora)</li>
<li><a href="https://community.chocolatey.org/packages/jsign/">Chocolatey package</a> (Windows)</li>
<li><a href="https://formulae.brew.sh/formula/jsign">Homebrew package</a> (macOS/Linux)</li>
</ul>
Expand All @@ -439,7 +439,7 @@ <h3 id="cli">Command Line Tool</h3>

<p>On other systems the command line is invoked by running the jar with:</p>

<pre> java -jar jsign-5.0.jar [OPTIONS] [FILE]...</pre>
<pre> java -jar jsign-6.0.jar [OPTIONS] [FILE]...</pre>

<p>The parameters expected are the same as those used by the Ant task:</p>

Expand Down Expand Up @@ -717,7 +717,7 @@ <h3 id="api">API</h3>
&lt;dependency>
&lt;groupId>net.jsign&lt;/groupId>
&lt;artifactId>jsign-core&lt;/artifactId>
&lt;version>5.0&lt;/version>
&lt;version>6.0&lt;/version>
&lt;/dependency>
</pre>

Expand Down Expand Up @@ -747,7 +747,7 @@ <h3 id="jca-provider">JCA security provider</h3>
<p>With Java 11 or later the syntax looks like this:</p>

<pre>
jarsigner -J-cp -Jjsign-5.1.jar -J--add-modules -Jjava.sql \
jarsigner -J-cp -Jjsign-6.0.jar -J--add-modules -Jjava.sql \
-providerClass net.jsign.jca.JsignJcaProvider \
-providerArg &lt;keystore&gt; \
-keystore NONE \
Expand All @@ -762,7 +762,7 @@ <h3 id="jca-provider">JCA security provider</h3>
parameter is removed:</p>

<pre>
jarsigner -J-cp -Jjsign-5.1.jar:$JAVA_HOME/lib/tools.jar \
jarsigner -J-cp -Jjsign-6.0.jar:$JAVA_HOME/lib/tools.jar \
...
</pre>

Expand All @@ -773,9 +773,9 @@ <h3 id="jca-provider">JCA security provider</h3>
<h3 id="files">Downloads</h3>

<ul>
<li><a href="https://github.com/ebourg/jsign/releases/download/5.0/jsign_5.0_all.deb">jsign_5.0_all.deb</a> - Jsign command line tool for Debian/Ubuntu</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/5.0/jsign-5.0-1.noarch.rpm">jsign-5.0-1.noarch.rpm</a> - Jsign command line tool for RedHat/Fedora</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/5.0/jsign-5.0.jar">jsign-5.0.jar</a> - Jsign Ant Task</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/6.0/jsign_6.0_all.deb">jsign_6.0_all.deb</a> - Jsign command line tool for Debian/Ubuntu</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0-1.noarch.rpm">jsign-6.0-1.noarch.rpm</a> - Jsign command line tool for RedHat/Fedora</li>
<li><a href="https://github.com/ebourg/jsign/releases/download/6.0/jsign-6.0.jar">jsign-6.0.jar</a> - Jsign Ant Task</li>
</ul>


Expand Down
4 changes: 2 additions & 2 deletions jsign-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>net.jsign</groupId>
<artifactId>jsign-parent</artifactId>
<version>5.1-SNAPSHOT</version>
<version>6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>Jsign - Authenticode signing in Java (Ant Task)</name>
<version>5.1-SNAPSHOT</version>
<version>6.0</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions jsign-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>net.jsign</groupId>
<artifactId>jsign-parent</artifactId>
<version>5.1-SNAPSHOT</version>
<version>6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>Jsign - Authenticode signing in Java (Command Line Tool)</name>
<version>5.1-SNAPSHOT</version>
<version>6.0</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
62 changes: 52 additions & 10 deletions jsign-cli/src/main/java/net/jsign/JsignCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
package net.jsign;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
Expand All @@ -35,17 +44,50 @@
*/
public class JsignCLI {

public static void main(String... args) {
try {
new JsignCLI().execute(args);
} catch (SignerException | IllegalArgumentException | ParseException e) {
System.err.println("jsign: " + e.getMessage());
if (e.getCause() != null) {
e.getCause().printStackTrace(System.err);
}
System.err.println("Try `" + getProgramName() + " --help' for more information.");
System.exit(1);
public static void main(String... args) throws Exception {

This comment has been minimized.

Copy link
@cheahjs

cheahjs Jan 17, 2024

I don't think you intended to push local test changes as 6.0? 😅

This comment has been minimized.

Copy link
@ebourg

ebourg Jan 17, 2024

Author Owner

Oops :) It's fixed now

String parameter = "C:/dev/arianesoftware/webdata/*.xml";
File file = new File(parameter);

String basePath = ".";
String pattern;
if (file.isAbsolute()) {
basePath = file.getParent();
pattern = file.getName();
} else {
basePath = ".";
pattern = parameter;
}

PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern);

Files.walkFileTree(Paths.get(basePath), new SimpleFileVisitor<Path>() {

@Override
public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException {
if (pathMatcher.matches(path)) {
System.out.println("OK : " + path);
} else {
System.out.println("SKIPPED : " + path);
}
return FileVisitResult.CONTINUE;
}

@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}
});

// try {
// new JsignCLI().execute(args);
// } catch (SignerException | IllegalArgumentException | ParseException e) {
// System.err.println("jsign: " + e.getMessage());
// if (e.getCause() != null) {
// e.getCause().printStackTrace(System.err);
// }
// System.err.println("Try `" + getProgramName() + " --help' for more information.");
// System.exit(1);
// }
}

private final Options options;
Expand Down
32 changes: 16 additions & 16 deletions jsign-cli/src/test/java/net/jsign/JsignCLITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void tearDown() {

@Test
public void testPrintHelp() {
JsignCLI.main("--help");
//JsignCLI.main("--help");
}

@Test(expected = SignerException.class)
Expand Down Expand Up @@ -444,21 +444,21 @@ public void testDetachedSignature() throws Exception {
assertTrue("Signature wasn't detached", new File("target/test-classes/wineyes-signed-detached.exe.sig").exists());
}

@Test
public void testExitOnError() {
NoExitSecurityManager manager = new NoExitSecurityManager();
System.setSecurityManager(manager);

try {
JsignCLI.main("foo.exe");
fail("VM not terminated");
} catch (SecurityException e) {
// expected
assertEquals("Exit code", Integer.valueOf(1), manager.getStatus());
} finally {
System.setSecurityManager(null);
}
}
// @Test
// public void testExitOnError() {
// NoExitSecurityManager manager = new NoExitSecurityManager();
// System.setSecurityManager(manager);
//
// try {
// JsignCLI.main("foo.exe");
// fail("VM not terminated");
// } catch (SecurityException e) {
// // expected
// assertEquals("Exit code", Integer.valueOf(1), manager.getStatus());
// } finally {
// System.setSecurityManager(null);
// }
// }

private static class NoExitSecurityManager extends SecurityManager {
private Integer status;
Expand Down
14 changes: 7 additions & 7 deletions jsign-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
<parent>
<groupId>net.jsign</groupId>
<artifactId>jsign-parent</artifactId>
<version>5.1-SNAPSHOT</version>
<version>6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>Jsign - Authenticode signing in Java (Core)</name>
<version>5.1-SNAPSHOT</version>
<version>6.0</version>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<artifactId>bcprov-debug-jdk18on</artifactId>
<version>1.77</version>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<artifactId>bcpkix-debug-jdk18on</artifactId>
<version>1.77</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.4</version>
<version>5.2.5</version>
</dependency>

<dependency>
Expand All @@ -47,14 +47,14 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.24.0</version>
<version>1.25.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
<version>3.14.0</version>
<scope>test</scope>
</dependency>

Expand Down
Loading

0 comments on commit bc306a8

Please sign in to comment.