Maven installed on the agent
JDK installed on the agent
access setup
client for the specific OS (client tools)
PKSC11 library (client tools)
Note
Client tools can be downloaded from DigiCert ONE® portal at > Resources > Client tool repository.
DigiCert® KeyLocker clients can be downloaded in a package.
Sign in to DigiCert ONE.
Navigate to DigiCert® KeyLocker > Resources > Client tool repository.
Select your operating system.
Click the download icon next to DigiCert® KeyLocker clients.
To create a configuration file with the path to this shared library:
Open an integrated development environment (IDE) or plain text editor.
Copy and paste the following text into the editor:
Save the file as pkcs11properties.cfg.
Move the pkcs11properties.cfg file to the same location as the PKCS11 library.
Operating systems use the environment variable called PATH to determine where executable files are stored on your system. Use the PATH environment variable to store the file path to your signing tools to ensure that the CLI can reference these signing tools.
DigiCert® KeyLocker enforces multifactor authentication for security. To access keypairs, certificates, and sign code, you need to set up two types of credentials: an API token and an authentication certificate.
The API token is an authentication method used to verify you as a user and your permissions assigned in DigiCert ONE. The API token provides the first factor authentication.
Follow these steps to generate an API token:
Sign in to DigiCert ONE.
Select the profile icon (top-right).
Select Admin Profile.
Scroll down to API Tokens.
Select Create API token.
Note
The API token is only shown once, securely store the API key to use it later.
The client authentication certificate is an authentication method used to verify you as a user and your permissions assigned in DigiCert ONE. The client authentication certificate provides the second factor authentication.
Follow these steps to create a client authentication certificate:
Sign in to DigiCert ONE.
Select the profile icon (top-right).
Select Admin Profile.
Scroll down to Authentication certificates.
Select Create authentication certificate.
Set the following environment variables:
Variable | Description |
---|---|
SM_API_KEY | Provide your API token. |
SM_CLIENT_CERT_FILE | Provide your client authentication certificate. |
SM_CLIENT_CERT_PASSWORD | Provide your client certificate password. |
SM_HOST | Provide your host environment. |
PKCS11_CONFIG | Provide the path to the PKCS11 configuration file. |
SM_TLS_SKIP_VERIFY | Enter true to disable or false to enable TLS verification on client side. |
Apache Maven provides a plugin for integration with jarsigner. To integrate the DigiCert® KeyLocker PKCS11 with your Maven implementation, you need to update the Build properties in your POM.xml file to use this plugin.
Plugins
groupId = org.apache.maven.plugins
artifactId = maven-jarsigner-plugin
version = 3.0.0
Executions
id = sign
goal = sign
Configurations
keystore = NONE
alias = <certificate alias>
storepass = none
keypass = none
providerClass = sun.security.pkcs11.SunPKCS11
storetype = PKCS11
providerArg = <path to pkcs11 config file>
For example:
<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 https://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.digicert</groupId>
<artifactId>signing</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>pkcs11</name>
<description>pkcs11 signing</description>
<url>https://github.com/company/project</url>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<dependencies/>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<keystore>NONE</keystore>
<alias>KPRose</alias>
<storepass>none</storepass>
<providerClass>sun.security.pkcs11.SunPKCS11</providerClass>
<storetype>PKCS11</storetype>
<providerArg>C:\smtools\pkcs11properties.cfg</providerArg>
<tsa>http://timestamp.digicert.com</tsa>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</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>ProjectName-@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
To verify a signature:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<certs>true</certs>
</configuration>
</plugin>