Skip to content

Commit

Permalink
[MSHARED-1344] Support for tsapolicyid and tsadigestalg
Browse files Browse the repository at this point in the history
Adding support for -tsapolicyid and -tsadigestalg
  • Loading branch information
schedin authored and slachiewicz committed Dec 23, 2023
1 parent 8171a93 commit c59e2ba
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</parent>

<artifactId>maven-jarsigner</artifactId>
<version>3.0.1-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>

<name>Apache Maven Jarsigner</name>
<description>A component to assist in signing jars.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ protected void build(JarSignerSignRequest request, Commandline cli) {
cli.createArg().setValue(tsaAlias);
}

String tsapolicyid = request.getTsapolicyid();
if (StringUtils.isNotBlank(tsapolicyid)) {
cli.createArg().setValue("-tsapolicyid");
cli.createArg().setValue(tsapolicyid);
}

String tsadigestalg = request.getTsadigestalg();
if (StringUtils.isNotBlank(tsadigestalg)) {
cli.createArg().setValue("-tsadigestalg");
cli.createArg().setValue(tsadigestalg);
}

File signedjar = request.getSignedjar();
if (signedjar != null) {
cli.createArg().setValue("-signedjar");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,55 @@
public class JarSignerSignRequest extends AbstractJarSignerRequest {

/**
* See <a href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html#Options">options</a>.
* See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
*/
private String keypass;

/**
* See <a href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html#Options">options</a>.
* See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
*/
private String sigfile;

/**
* See <a href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html#Options">options</a>.
* The {@code -tsa} parameter, the URL to the Time Stamping Authority (TSA) server.
* See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
*/
private String tsaLocation;

/**
* See <a href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html#Options">options</a>.
* The {@code -tsacert} parameter. Alias for a certificate in the active keystore. From the certificate the X509v3
* extension "Subject Information Access" field is examined to find a TSA server URL.
* See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
*/
private String tsaAlias;

/**
* See <a href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html#Options">options</a>.
* The {@code -tsapolicyid} parameter, an OID to send to the TSA server to identify the policy ID the server should
* use. See
* <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
*
* @since 3.1.0
*/
private String tsapolicyid;

/**
* The {@code -tsadigestalg} parameter, the message digest algorithm for TSA server to use. Only available in Java
* 11 and later. See
* <a href="https://docs.oracle.com/en/java/javase/11/tools/jarsigner.html">options</a>.
*
* @since 3.1.0
*/
private String tsadigestalg;

/**
* See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
*/
protected File signedjar;

/**
* Location of the extra certchain file to be used during signing.
*
* See <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jarsigner.html#Options">options</a>.
* See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
* @since 3.0.0
*/
protected File certchain;
Expand All @@ -77,6 +98,14 @@ public String getTsaAlias() {
return tsaAlias;
}

public String getTsapolicyid() {
return tsapolicyid;
}

public String getTsadigestalg() {
return tsadigestalg;
}

public void setKeypass(String keypass) {
this.keypass = keypass;
}
Expand All @@ -93,6 +122,14 @@ public void setTsaAlias(String tsaAlias) {
this.tsaAlias = tsaAlias;
}

public void setTsapolicyid(String tsapolicyid) {
this.tsapolicyid = tsapolicyid;
}

public void setTsadigestalg(String tsadigestalg) {
this.tsadigestalg = tsadigestalg;
}

public File getSignedjar() {
return signedjar;
}
Expand Down

0 comments on commit c59e2ba

Please sign in to comment.