Skip to main content

Coming Soon: Binary Signing for GitLab CI/CD

DigiCert Binary Signing for GitLab CI/CD enables organizations to seamlessly integrate secure code signing into GitLab pipelines using DigiCert​​®​​ Software Trust Manager.

This production-ready CI/CD template supports Linux, macOS, and Windows runners, offering both simplified and traditional signing workflows to align with diverse build and release strategies.

The template automates the setup and execution of DigiCert signing tools, enabling secure keypair-based signing while ensuring private keys remain protected within Software Trust Manager. This approach eliminates direct key exposure in CI environments and strengthens overall signing security.

Supported signing approaches

Simple signing:

  • Uses the DigiCert SMCTL command-line tool (installed automatically by this template) to sign files directly from the pipeline.

  • Supports bulk signing of directories.

Traditional signing:

Integrates with third-party signing tools using the following libraries:

  • JCE

  • PKCS#11

  • KSP

  • CSP

Features:

  • Cross-platform support: Linux, macOS, and Windows.

  • Bulk signing support (only for simple signing). Using bulk signing you can sign multiple files at a time.

  • Secure integration with GitLab Secure Files.

  • Automatic tool download and caching.

  • JCE, PKCS#11, KSP, and CSP support for traditional workflows.

  • Production-ready error handling, logging, and best practices built-in.

Before you begin

  1. Active Software Trust Manager Account.

    Active subscription with Software Trust Manager.

    API key with signing permissions.

    Client certificate (.p12 file) with password.

  2. Set up GitLab Project.

    GitLab project with CI/CD enabled.

    GitLab runner (SaaS or self-hosted) for your target platform.

  3. Configured required environment variables (see configurations table below).

Variable

Default

Description

INPUT 

(required)

File or directory to sign

KEYPAIR_ALIAS 

(required)

DigiCert keypair alias for signing

DIGEST_ALG 

SHA-256

Digest algorithm (SHA-256, SHA-384, SHA-512)

TIMESTAMP 

true

Enable RFC 3161 timestamping

FAIL_FAST 

true

Stop on first error in bulk signing

BULK_SIGN_MODE 

false

Enable bulk signing for directories

UNSIGNED_ONLY 

false

Skip already signed files

ZERO_EXIT_CODE_ON_FAILURE 

false 

Return exit code 0 even on signing failure

CACHE_VERSION 

0.0.0-0

Cache version (change to force re-download)

DIGICERT_CDN 

https://pki-downloads.digicert.com/stm/latest

DigiCert CDN URL

Get started with DigiCert Binary Signing for GitLab CI/CD

Use this section if you are setting up DigiCert Binary signing in GitLab CI/CD template for the first time. This procedure walks you through creating a new workflow and configuring the required credentials and inputs.

Upload your DigiCert client certificate (.p12 file) to GitLab Secure Files:

  1. Navigate to your GitLab project.

  2. Go to Settings > CI/CD >Secure Files.

  3. Select Upload File  and select your .p12 certificate.

Note

The template will automatically detect and use certificates having a .p12 extension.

Add your host, API key, and client certificate password to GitLab variables:

  1. Navigate to your GitLab project.

  2. Go to Settings > CI/CD >Variables .

  3. In the  Project variables section, select Add variable.

  4. Add the following variables:

Variable

Descriptions

Required

Protected

Masked

SM_HOST 

DigiCert API host (e.g., https://clientauth.one.digicert.com)

Yes

Yes

No

SM_API_KEY 

Your DigiCert API key

Yes

Yes

Yes

SM_CLIENT_CERT_PASSWORD

Password for your .p12certificate

Yes

Yes

Yes

SM_CLIENT_CERT_FILE

Path to certificate (use only if not using Secure Files)

No

Yes

No

Note

Mark sensitive variables as protected and masked for security.

Add digicert-signing-template to your .gitlab-ci.yml

include:   - remote: 'https://gitlab.com/<your-namespace>/digicert-signing-template/-/raw/main/templates/digicert-signing.yml' 

For simple signing mode you must:

  • Specify the extend as .simple-signing.

  • Enter the variables; KEYPAIR_ALIAS and INPUT.

For traditional signing mode you must:

  • Specify the extend as .traditional-signing.

  • Use SMCTL or third-party tools signing commands for signing the files with your keypair alias.

Linux/macOS jobs

Linux/macOS templates:

  • .simple-signing - Simple signing without third-party tools (supports bulk signing).

  • .traditional-signing - Traditional signing with PKCS#11 setup and more.

Note

To setup a GitLab runner, see https://docs.gitlab.com/runner/install/.

Windows templates

  • .simple-signing-windows - Simple signing for Windows (supports bulk signing of directories)

  • .traditional-signing-windows - Traditional signing with PKCS#11, KSP, and CSP and more (PowerShell)

Note

To setup a GitLab runner, see https://docs.gitlab.com/runner/install/.

Samples: Complete pipelines

Security Best Practices

Protect sensitive variables

  • Mark SM_API_KEY and SM_CLIENT_CERT_PASSWORD as masked.

  • Mark all signing variables as protected.

  • Use protected branches for production signing.

Secure certificate storage

  • Always use GitLab Secure Files for certificates.

  • Never commit certificates to Git repositories.

  • Rotate certificates before expiration.

Audit and logging

  • Review signing job logs regularly.

  • Monitor DigiCert console for signing activity.

  • Set up alerts for unusual activity.

Access control

  • Limit who can modify CI/CD variables.

  • Use protected branches for production pipelines.

  • Implement approval gates for deployments.

Troubleshooting

For common errors and solutions, see Troubleshooting chapter.