amphibient
amphibient

Reputation: 31248

Changing digest algorithm for maven-jarsigner-plugin

How can I change the default (in my case SHA256) digest algorithm within the configuration of maven-jarsigner-plugin? I would like it to be SHA1. I tried adding <digestalg>SHA1</digestalg> to the configuration block in the pom but that didn't do it because MANIFEST.MF still came out reporting SHA256.

In a command line, you would just do:

jarsigner ... -digestalg SHA1 myjar.jar myalias

Upvotes: 2

Views: 765

Answers (1)

amphibient
amphibient

Reputation: 31248

As per this post, using arguments worked for me:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jarsigner-plugin</artifactId>
    <version>1.4</version>
    <executions>
      <execution>
        <phase>package</phase>
        <id>sign</id>
        <goals>
          <goal>sign</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <keystore>mykey.jks</keystore>
      <alias>myalias</alias>
      <storepass>somepass</storepass>
      <arguments>
          <argument>-digestalg</argument><argument>SHA1</argument>
      </arguments>
    </configuration>
</plugin>

Upvotes: 2

Related Questions