CodeSign Secure Documentation
  • Overview
    • About CodeSign Secure
    • Getting Started
    • Documentation Guide
    • Portal Overview
    • Troubleshooting
      • FAQ
    • Glossary
  • Reference Guide
    • Header Bar
      • CodeSign Secure Documentation
      • Swagger API
      • Profile Section
    • Dashboard
      • Key Performance Indicators
      • Issued Certificates
      • Signatures Generated
      • HSM Health Check
    • Keys and Certificates
      • Key and Certificate Lifecycle
    • App Management
    • Signing Requests
      • Approval Workflows
    • Signing Tools
    • Reports
      • Signing Request Report
      • Audit Trail
      • Certificate Report
      • Client Report
    • Logs
    • System Setup
      • Identity Store
      • Backup
      • User
      • Roles and Permissions
      • Email
      • Signing Projects
      • SSL/TLS Management
      • Environment
      • Plugins
  • Setup & Architecture
    • Identity and Access Control
    • Architecture and Concepts
    • Installation
      • Windows
        • Installing the Server
        • Ports and Protocols
        • High Availability and Backup
        • Upgrades and Compatibility
    • Security
      • Security Hardening Checklist
      • Client Authentication
      • Designing Signing Policies
  • Release Notes
    • Releases for 2026
      • v3.2.1
    • Releases for 2025
      • v3.2.0
    • Releases for 2024
      • v3.1.0
  • API Reference
    • Getting Started
    • Authorizing Requests
    • Securing API Access
    • Request and Response Conventions
    • Endpoint Reference
      • Signing
      • Signing Requests
      • Certificates
      • Applications and Environments
      • User Management
      • Permissions
      • Email
      • System Setup
      • Reports
      • Dashboard
      • License
  • Integration Guides
    • Signing Capabilities
      • Supported Formats and Platforms
      • Timestamping
      • Windows Signing - SignTool
        • Signing
        • Macro Signing
      • Apple Signing
      • AppX & MSIX Signing
      • Visual Studio ClickOnce
      • Jar Signing
      • Sign HLK/HCK using CodeSign Secure
      • NuGet Signing
      • Mage Signing
      • Sign OVA/OVF using Encryption Consulting’s Utility Tool
      • Utility Tool for code signing
      • Container Signing
      • PKCS11 Wrapper
        • APK Signing
        • OpenSSL Signing
        • XML Signing
        • JSign Tool Signing
        • Jarsigner Signing
        • GPG2, Debian & RPM Signing
      • Reproducible Build
        • Automated Hash Validation
        • Reproducible Build Process Flow
        • Pipeline Script Components
        • Hash Validation
    • CI/CD Integration
      • GitHub Actions
      • Jenkins
      • GitLab
      • Azure DevOps
      • TeamCity
      • Bamboo
      • Securing CI/CD Credentials

PKCS#11 Wrapper

The Encryption Consulting PKCS#11 Wrapper lets standard signing tools on Windows, Linux and macOS sign with keys held in CodeSign Secure.

Overview

The wrapper is a PKCS#11 library. Tools such as apksigner, jarsigner, JSign, OpenSSL, XML signing tools, and GnuPG load it like any PKCS#11 token. The wrapper authenticates to CodeSign Secure, sends the hash for signing over PKCS#11 api calls, and returns the signature to the tool.

  • Download it from Signing Tools for your operating system.

  • It is configured with ec_pkcs11client.ini, whose path you set in the EC_INI_FILE_PATH environment variable.

  • Also requires the pkcs11properties.cfg file that points to the wrapper library.

ec_pkcs11client.ini reference
[logconfig_file]
name = <Path to EC_PKCS11_CLIENT-LogConfig.xml>    ; ships in the wrapper download

[server_url]
url = https://codesign.example.com

[pfxfile_path]
path = <Path to client auth certificate>           ; client authentication certificate

[pfxfile_passwd]
passwd = <PFX password>

[login_token]
username = <CodeSign Secure Registered username>
passcode = <CodeSign Secure passcode>

; Optional: the key to sign with (v3.02.01 and later)
;[key_filter]
;label = EC-Cert-020
SectionKeyRequiredDescription
[logconfig_file]nameYesAbsolute path to EC_PKCS11_CLIENT-LogConfig.xml, which ships in the wrapper download and controls logging
[server_url]urlYesYour CodeSign Secure address, for example https://codesign.example.com
[pfxfile_path]pathYesAbsolute path to the client authentication certificate (PFX) generated in System Setup > User
[pfxfile_passwd]passwdYesThe PFX Certificate password
[login_token]usernameYesCodeSign Secure Registered username
[login_token]passcodeYesCodeSign Secure passcode
[key_filter]labelNoThe key label to sign with, for example EC-Cert-020. Available from 3.02.01.

Important: This file holds passwords. Never commit it to source control. See Client Authentication.

pkcs11properties.cfg reference
name = signingmanager

#ships in the wrapper download
library = <Path to ec_pkcs11client PKCS#11 library (.dll, .so, and .dylib)>

#only required for Thales Luna HSM
#slot=0

attributes = compatibility

attributes(*, *, *) = {
CKA_TOKEN=true
}
KeyRequiredDescription
libraryYesAbsolute path to ec_pkcs11client library (.dll, .so, and .dylib), which ships in the wrapper download and controls PKCS#11 api calls
slotNoOnly required for Thales Luna HSM
Environment variables
VariableRequiredValuesDefault
EC_INI_FILE_PATHYesAbsolute path to ec_pkcs11client.iniNot set
EC_PKCS11_KEY_LABELNoThe key label to sign withNot set
EC_PKCS11_NO_AUTO_KEY_LABELNo1 turns off automatic key label detectionNot set: detection on
EC_PKCS11_DISABLE_CACHENo1 turns off key cachingNot set: cache on
# Linux and macOS (current shell)
export EC_INI_FILE_PATH=/opt/ec/ec_pkcs11client.ini

# Windows PowerShell (current session)
$env:EC_INI_FILE_PATH = "C:\PKCS11_Wrapper-Windows\ec_pkcs11client.ini"

# Windows (persistent; open a new console afterwards)
setx EC_INI_FILE_PATH "C:\PKCS11_Wrapper-Windows\ec_pkcs11client.ini"
Key label and caching (3.02.01)

The wrapper caches the signing key, so repeated signing is faster. It needs to know which key to use, and you can tell it in one of three ways:

MethodHow
Automatic detection (default)The wrapper reads the key label from the signing tool’s command line, for example, the alias passed to jarsigner
Environment variableEC_PKCS11_KEY_LABEL=EC-Cert-020
INI file[key_filter] section with label = EC-Cert-020
  • Use one method at a time so it is always clear which key is used.

  • Set EC_PKCS11_NO_AUTO_KEY_LABEL=1 to stop automatic detection, for example when the label is always set explicitly.

  • Set EC_PKCS11_DISABLE_CACHE=1 to test without the cache when a certificate has changed and the wrong key seems to be used.

Signing guides
  • APK Signing

  • OpenSSL Signing

  • XML Signing

  • JSign Tool Signing

  • Jarsigner Signing

  • GPG2, Debian & RPM Signing

For errors, see Troubleshooting.

On this Page:
Support Privacy Policy Terms of Service

Copyright Encryption Consulting LLC. All rights reserved.