Skip to content

About

Forked from Inductive Automation's Module-Signer, added PKCS11 Hardware Token support

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Getting started with module-signer

Prerequisites

  • Java 11 or later installed and on your path.
  • One of the following:
    • A Java Keystore (in jks or pfx format) containing either:
      • A self-generated and self-signed code signing certificate.
      • A code signing certificate, obtained from and signed by a CA, and the certificate chain that goes with it.
    • OR a PKCS11 hardware token (e.g., SafeNet eToken, YubiKey) with an EV Code Signing certificate.

Keystore Explorer is an easy to use tool for creating and managing keystores and certificates.

Invocation

Using a traditional keystore (JKS or PFX)

Invocation from the command-line:

java -jar module-signer.jar \
	--keystore=<path-to-my-keystore>/keystore.jks \
	--keystore-pwd=<password> \
	--alias=server \
	--alias-pwd=<password> \
	--chain=<pathToMyp7b>/cert.p7b \
	--module-in=<path-to-my-module>/my-unsigned-module.modl \
	--module-out=<path-to-my-module>/my-signed-module.modl

Using a PKCS11 hardware token (e.g., SafeNet eToken)

Invocation from the command-line:

java -jar module-signer.jar \
	--pkcs11-cfg=<path-to-config>/safenet.cfg \
	--keystore-pwd=<your-token-pin> \
	--alias=<certificate-alias> \
	--module-in=<path-to-my-module>/my-unsigned-module.modl \
	--module-out=<path-to-my-module>/my-signed-module.modl

Note: When using PKCS11:

  • The --chain parameter is optional - the certificate chain will be automatically extracted from the token
  • The --keystore parameter is not needed
  • The --keystore-pwd should contain your token PIN (required for most tokens)
  • The --alias-pwd is optional and usually not needed for PKCS11 tokens
  • You must create a PKCS11 configuration file (see example below)
  • The signer name displayed in Ignition will be extracted from your certificate's Common Name (CN) field

Parameters Explained

keystore

The path to the keystore containing your code signing certificate. Can be either JKS or PFX format.

keystore-pwd

The password to access the keystore.

alias

The alias under which your code signing certificate is stored.

alias-pwd

The password to access the alias.

chain

The path to the certificate chain (in p7b format). This file will is generally returned along with your signed certificate after submitting a CSR to a CA.

module-in

The path to the unsigned module.

module-out

The path the signed module will be written to.

pkcs11-cfg

The path to the PKCS11 configuration file. Required when using a hardware token.

PKCS11 Configuration

When using a hardware token (such as SafeNet eToken), you need to create a PKCS11 configuration file. This file tells Java how to communicate with your hardware token.

Example SafeNet eToken Configuration File (safenet.cfg)

Windows:

name = SafeNet
library = C:/Windows/System32/eTPKCS11.dll

Linux:

name = SafeNet
library = /usr/lib/libeTPkcs11.so

macOS:

name = SafeNet
library = /Library/Frameworks/eToken.framework/Versions/Current/libeTPkcs11.dylib

Finding the PKCS11 Library Path

The library path depends on your token vendor and operating system:

  • SafeNet eToken: Usually eTPKCS11.dll (Windows) or libeTPkcs11.so (Linux)
  • YubiKey: Usually libykcs11.dll (Windows) or libykcs11.so (Linux)
  • Generic PKCS11: Check your token vendor's documentation

To find the library on your system:

  • Windows: Search for *.dll files in C:\Windows\System32 or your token software installation directory
  • Linux: Run find /usr/lib -name "*pkcs11*.so"
  • macOS: Run find /Library/Frameworks -name "*pkcs11*"

Finding Your Certificate Alias

To list all available aliases on your token, you can use the KeyStore Explorer tool or run a simple Java command. If you're unsure of the alias, the module-signer will display available aliases if it cannot find the one you specified.

About

Forked from Inductive Automation's Module-Signer, added PKCS11 Hardware Token support

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages