This guide assumes your Product Admin has already created a Signer and assigned you to it. If the signer has an approval policy, you’ll also need active access before signing.
cosign (from the Sigstore project) with the Infisical PKCS#11 module. Container image signing is a critical part of securing software supply chains. It lets you verify that images in your registry were built by trusted pipelines.
Prerequisites
- A Signer created by your Product Admin
- Active signing access (if an approval policy is attached)
- A machine identity added to the Signer
- The Infisical PKCS#11 module installed and configured
cosignv2.0 or later, built with PKCS#11 support (see below)- Write access to an OCI-compatible container registry
Step 1: Set Up Authentication
Configure the Infisical PKCS#11 module with your machine identity credentials. Without this, the signing commands below fail with an auth error. Create/etc/infisical/pkcs11.conf (or set INFISICAL_PKCS11_CONFIG to point elsewhere):
Environment variables override values from the config file.
Step 2: Install cosign with PKCS#11 Support
- Go install (recommended)
- Build from source
This cosign was not built with pkcs11-tool support!, you need to rebuild with the pkcs11key tag.
Step 3: Sign a Container Image
First, list the available tokens and key URIs to find the correct PKCS#11 URI for your signer:- The
--keyflag uses a PKCS#11 URI. Thetokenmust match your signer’s token label andobjectmust match the key label. Usecosign pkcs11-tool list-keys-uristo find the exact URI. - Set
COSIGN_PKCS11_MODULE_PATHto the absolute path of the Infisical PKCS#11 shared library. - Use
--tlog-upload=falseif you are not using a Sigstore transparency log. - cosign pushes the signature to the same registry alongside the image.
- You may need to authenticate to your container registry first (e.g.,
docker loginorcosign login). - Prefer signing by digest (
@sha256:...) rather than tag for reproducible builds.
Step 4: Verify the Signature
Verify a signed image using the public key or certificate from the signer:Use
--insecure-ignore-tlog if you signed without uploading to a transparency log. In production, configure a transparency log for auditability.CI/CD Integration
Example for a container build pipeline:Kubernetes Admission Control
Combine cosign verification with a Kubernetes admission controller (e.g., Kyverno or Connaisseur) to enforce that only signed images are deployed:Troubleshooting
For any issue, enable debug logging in your config file ("log_level": "debug", "log_file": "/tmp/infisical-pkcs11.log") to get detailed output.
'unimplemented' or 'not built with pkcs11-tool support'
'unimplemented' or 'not built with pkcs11-tool support'
Your cosign binary was not built with PKCS#11 support. Pre-built binaries (including Homebrew) do not include it. Rebuild from source with
CGO_ENABLED=1 go install -tags pkcs11key github.com/sigstore/cosign/v2/cmd/cosign@latest.Error getting signer or key not found
Error getting signer or key not found
Ensure the PKCS#11 URI includes both
token and object fields matching your signer name, and that COSIGN_PKCS11_MODULE_PATH is set to the absolute path of the module. Use cosign pkcs11-tool list-keys-uris to find the correct URI.What’s Next?
Sign JARs
Sign Java artifacts with jarsigner
Sign with GPG
Sign git commits and packages with GPG