From 9018c62d1f3d126dd1ccf32bb5ac0f33a1f75d65 Mon Sep 17 00:00:00 2001 From: Daniel Fischer <35335704+iqdoq-dfischer@users.noreply.github.com> Date: Sat, 10 Oct 2026 00:18:41 +0200 Subject: [PATCH] The Maven plugin no longer timestamps by default (Fixes #366) The default value of tsmode enabled the timestamping although neither tsaurl nor tsmode was configured. SignerHelper already falls back to Authenticode when tsmode is null. --- README.md | 2 ++ .../src/main/java/net/jsign/JsignMojo.java | 4 ++-- .../src/test/java/net/jsign/JsignMojoTest.java | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9720c056..e03ad1a9 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ See https://ebourg.github.io/jsign for more information. * The error message displayed when the PE certificate table is corrupted has been improved * The "_missing provider_" error with the Jsign JCA provider has been fixed (contributed by Lukas Schmitt) * The bash completion script now supports the `--tsmode` and `--alg` parameters +* The Maven plugin no longer timestamps the signature when neither `tsaurl` nor `tsmode` is set, + like the Ant task and the command line tool (contributed by Daniel Fischer) * API changes: * The new JsignTool class provides a high level API equivalent to the command line tool * Upgraded Bouncy Castle LTS to 2.73.10 diff --git a/jsign-maven-plugin/src/main/java/net/jsign/JsignMojo.java b/jsign-maven-plugin/src/main/java/net/jsign/JsignMojo.java index 00e5c7bc..fa995064 100644 --- a/jsign-maven-plugin/src/main/java/net/jsign/JsignMojo.java +++ b/jsign-maven-plugin/src/main/java/net/jsign/JsignMojo.java @@ -133,8 +133,8 @@ public class JsignMojo extends AbstractMojo { @Parameter( property = "jsign.tsaurl" ) private String tsaurl; - /** The protocol used for the timestamping (RFC3161 or Authenticode) */ - @Parameter( property = "jsign.tsmode", defaultValue = "Authenticode" ) + /** The protocol used for the timestamping (RFC3161 or Authenticode, Authenticode by default) */ + @Parameter( property = "jsign.tsmode" ) private String tsmode; /** The number of retries for timestamping */ diff --git a/jsign-maven-plugin/src/test/java/net/jsign/JsignMojoTest.java b/jsign-maven-plugin/src/test/java/net/jsign/JsignMojoTest.java index fb9107a2..4cd26f0f 100644 --- a/jsign-maven-plugin/src/test/java/net/jsign/JsignMojoTest.java +++ b/jsign-maven-plugin/src/test/java/net/jsign/JsignMojoTest.java @@ -17,18 +17,23 @@ package net.jsign; import java.io.File; +import java.io.FileReader; +import java.io.Reader; import java.util.Collections; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; import org.apache.maven.shared.model.fileset.FileSet; +import org.codehaus.plexus.configuration.PlexusConfiguration; import org.mockito.MockedConstruction; import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; @@ -236,6 +241,18 @@ public void testSignUnsupportedFile() throws Exception { assertEquals("Unsupported file: pom.xml", e.getMessage()); } + public void testNoTimestampingByDefault() throws Exception { + // a default value for tsaurl or tsmode would enable the timestamping although none is configured + PluginDescriptor descriptor; + try (Reader reader = new FileReader("target/classes/META-INF/maven/plugin.xml")) { + descriptor = new PluginDescriptorBuilder().build(reader); + } + PlexusConfiguration configuration = descriptor.getMojo("sign").getMojoConfiguration(); + + assertNull("tsaurl default value", configuration.getChild("tsaurl").getAttribute("default-value")); + assertNull("tsmode default value", configuration.getChild("tsmode").getAttribute("default-value")); + } + public void testDetachedSignature() throws Exception { File sourceFile = new File("target/test-classes/wineyes.exe"); File targetFile = new File("target/test-classes/wineyes-signed-with-maven.exe");