Integrating Java hash signing CSP with Apache Maven

Apache Maven provides a plugin for integration with jarsigner. To integrate the Java Hash Signing CSP with your Maven implementation, you need to update the Build properties in your POM.xml file to use this plugin along with the CSP.

Configuration

Update the build properties in your POM file as follows.

plugins

xml
groupId = org.apache.maven.plugins
artifactId = maven-jarsigner-plugin
version = 1.4

executions

xml
id = sign
goal = sign

configurations

These are the same values that you use in your CSP’s properties file. Namely:

xml
keystore = NONE
alias = <certificate friendly name>, <name of the application>, <version of the application (optional)>
storepass = none
keypass = none
providerClass = com.symantec.sas.csp.CSPProvider
storetype = SAS
arguments = -J-DcspPropertiesFile=<path to your CSP’s properties file>

See the sample code below for example values.

Sample Maven POM file

Following is a sample project that shows how you may implement this integration:

xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<artifact.classifier />
</properties>
<groupId>com.anshuman</groupId>
<artifactId>vanilla</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Vanilla</name>
<description>Vanilla Testing for JarSigner</description>
<url>https://github.com/brettwooldridge/HikariCP</url>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<dependencies/>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<keystore>NONE</keystore>
<alias>SASDemo1,maven_signing</alias>
<storepass>none</storepass>
<keypass>none</keypass>
<providerClass>com.symantec.sas.csp.CSPProvider</providerClass>
<storetype>SAS</storetype>
<arguments>-J-DcspPropertiesFile=C:\users\anshuman_mor\desktop\testing\java\ft1.properties</arguments>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<extensions>true</extensions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>-Xlint</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.release.version}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>HikariCP-@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

We use cookies to ensure that we give you the best experience on our website. By using this site, you agree to the Terms of Service.