Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions jsign-maven-plugin/src/main/java/net/jsign/JsignMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
17 changes: 17 additions & 0 deletions jsign-maven-plugin/src/test/java/net/jsign/JsignMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down