The short answer
Use osslsigncode: osslsigncode sign -pkcs11module <token-library.so> -pkcs11cert <cert URI> -key <key URI> -h sha256 -ts http://time.certum.pl -in app.exe -out app-signed.exe writes an Authenticode signature on Linux, and brew install osslsigncode gives you the same tool on macOS. For a publicly trusted certificate the private key has had to sit in certified hardware since June 1, 2023, so you sign through a token or cloud service, not a .p12 file. On Ubuntu 24.04 the packaged PKCS#11 engine crashed in our test; Debian 13 signed cleanly.
On this page
- Can you sign a Windows EXE on Linux?
- Which osslsigncode version do you need?
- Where does the private key have to live?
- How do you sign an EXE with a PKCS#11 token?
- Can you sign with a SimplySign cloud key on Linux?
- How do you check the signature and its timestamp?
- What do the common osslsigncode errors mean?
- FAQ
Updated November 12, 2026: every command on this page, except the SimplySign and macOS ones, was run on Debian 13 and Ubuntu 24.04 with a SoftHSM test token and Certum's timestamp server, and the output shown is what came back. The version table, error messages and verify advice are new; the earlier claim that 2.9 was the current release was out of date.
Can you sign a Windows EXE on Linux?
Yes. osslsigncode is an open-source tool that, in its own words, implements the Authenticode signing and timestamping part of Microsoft's signtool.exe. Authenticode is the Microsoft format that names the publisher of a file and shows it hasn't changed since signing, so a team that cross-compiles Windows binaries on Linux CI or builds on macOS can sign the release where it is built instead of keeping a Windows machine around just for signtool.
Our test file was a 14,848-byte hello.exe cross-compiled on Ubuntu with MinGW-w64. After signing with a timestamp it was 23,024 bytes, the difference being the signature block with Certum's countersignature inside it. We did not run the signed file on Windows for this update, so the checks below are osslsigncode's own verification.
Linux-native packages are a different job. A .rpm or .deb is signed with an OpenPGP key, not a code signing certificate; see how to sign RPM and DEB packages if your release ships both.
Which osslsigncode version do you need?
The osslsigncode version your package manager installs decides which file types and key interfaces you get, and on Ubuntu 24.04 the packaged set crashed when signing with a token in our test. Upstream released 2.15 on November 6, 2026, but most distributions ship something older. Check with osslsigncode --version before you script anything.
| Where you get it | Version (Nov 2026) | What that version means |
|---|---|---|
| Upstream (GitHub) and Homebrew | 2.15 | Everything below, plus the OpenSSL 3 PKCS#11 provider and a verify fix: a failed timestamp check now fails the command |
| Debian 13 (trixie) | 2.9 | PowerShell scripts, no libcurl; PKCS#11 through the libp11 engine. Our clean test run. |
| Ubuntu 24.04 LTS | 2.8 | PowerShell scripts; PKCS#11 signing crashed in our test (see below) |
| Debian 12 (bookworm) | 2.5 (2.9 in backports) | No PowerShell signing; use the backports package |
The cut-off points come from the project's release notes: PowerShell signing arrived in 2.8, 2.9 dropped libcurl in favour of OpenSSL's own HTTP client, and 2.10 added JavaScript signing and support for the OpenSSL 3 PKCS#11 provider.
Ubuntu 24.04 and PKCS#11. With the stock packages (osslsigncode 2.8-2, libengine-pkcs11-openssl 0.4.12-1.1ubuntu2, OpenSSL 3.0.13) every token signing attempt in our test ended in Segmentation fault (exit code 139) inside the pkcs11 engine. It also left a 12,288-byte half-written output file, so the next attempt failed with Overwriting an existing file is not supported. Ubuntu tracks the crash as bug 2119094. Signing with a .p12 file worked on the same machine, and the same token commands worked on Debian 13. Until Ubuntu ships a fix, sign in a Debian 13 container.
sudo apt install osslsigncode libengine-pkcs11-openssl gnutls-bin opensc
osslsigncode --version # Debian 13 prints: osslsigncode 2.9, using: ...
# macOS
brew install osslsigncodeWhere does the private key have to live?
A publicly trusted code signing key has to be generated, stored and used in a hardware crypto module, a CA/Browser Forum rule in force since June 1, 2023. The hardware must be certified to at least FIPS 140-2 Level 2 or Common Criteria EAL 4+: a CA-supplied token, your own HSM, or a cloud signing service. That rule is the same on Linux as on Windows; the operating system only changes the tool that talks to the key.
osslsigncode reaches that hardware through PKCS#11, a standard library interface (a .so file supplied by the token vendor or by OpenSC) that lets a program ask the device to sign a hash without ever reading the key. If you still need the certificate itself, our Certum code signing certificates come with the key held in Certum's SimplySign cloud service; read the SimplySign section below before you plan a Linux pipeline around one. The background on how the certificate, key and signature fit together is in code signing certificates explained.
osslsigncode still accepts -pkcs12 file.p12, and in our test that route signed fine on both Debian and Ubuntu. Use it for a self-signed smoke test; a public CA no longer hands out code signing keys you can put in a file. For the trade-offs between a physical token and a cloud key, see cloud code signing vs USB tokens.
How do you sign an EXE with a PKCS#11 token?
Signing with a PKCS#11 token takes two commands: list the token's objects with p11tool to get their URIs, then pass the module path and both URIs to osslsigncode sign. We used SoftHSM, a software token that speaks the same PKCS#11 interface as a USB token, with a self-signed RSA-3072 test certificate. On a real token only the module path and the labels change.
p11tool --provider /usr/lib/softhsm/libsofthsm2.so --list-all --login
# Output from our test token (trimmed):
URL: pkcs11:model=SoftHSM%20v2;...;token=codesign-test;id=%01;object=signkey;type=private
Type: Private key (RSA-3072)
URL: pkcs11:model=SoftHSM%20v2;...;token=codesign-test;id=%01;object=signcert;type=cert
Type: X.509 Certificate (RSA-3072)You don't need the whole URI. token=, object= and type= were enough to select the right objects, and they survive a token being re-initialised with a new serial number. With a vendor token, replace the module path with the vendor's library or OpenSC's opensc-pkcs11.so, and copy the labels that p11tool prints for your device.
osslsigncode sign \
-pkcs11module /usr/lib/softhsm/libsofthsm2.so \
-pkcs11cert 'pkcs11:token=codesign-test;object=signcert;type=cert' \
-key 'pkcs11:token=codesign-test;object=signkey;type=private' \
-readpass /run/secrets/token-pin \
-h sha256 \
-ts http://time.certum.pl \
-in app.exe -out app-signed.exe
# Output (trimmed):
Engine "pkcs11" set.
SucceededThree details from the run. The token PIN goes in with -readpass (a file, or - for standard input); -pass also works, but the osslsigncode documentation recommends -readpass or -askpass for safer secret handling. Version 2.9 loaded the pkcs11 engine by itself, so -pkcs11engine wasn't needed. And -out must name a file that doesn't exist yet: osslsigncode refuses to overwrite, even when the existing file is a leftover from a failed run.
Can you sign with a SimplySign cloud key on Linux?
Signing with a Certum SimplySign cloud key from osslsigncode on Linux is possible in principle but not documented by Certum, and we haven't tested it. SimplySign Desktop, in Certum's words, "emulates the connection of a physical cryptographic card and card reader" while the key stays in Certum's cloud, which would leave osslsigncode the same job as with a token: the same flags with a different PKCS#11 module.
The gaps are on Certum's side of the documentation. Its signing manual (Ver. 1.1) covers signtool and jarsigner on Windows only and names a PKCS#11 library only for Windows (SimplySignPKCS.dll). Connecting SimplySign Desktop takes your username plus a code from the SimplySign mobile app, and the Linux build requires a graphical desktop: Cinnamon, MATE or KDE Plasma on x86-64 Debian, Ubuntu, Mint, CentOS or Fedora. As of November 2026 the Certum pages in the sources list describe no unattended mode, so with Certum's own software plan for a build machine where a person opens the session before the signing job runs. Installing the app and pairing the phone are covered in the SimplySign Desktop setup guide.
# Certum names no Linux PKCS#11 library. If your install ships one,
# put its path here and copy the URIs that p11tool prints.
p11tool --provider /path/to/simplysign-pkcs11-library.so --list-all --login
osslsigncode sign \
-pkcs11module /path/to/simplysign-pkcs11-library.so \
-pkcs11cert '<certificate URI from p11tool>' \
-key '<private key URI from p11tool>' \
-h sha256 -ts http://time.certum.pl \
-in app.exe -out app-signed.exeThe osslsigncode README now has a section on cloud PKCS#11 modules and names one for SimplySign, ssign-pkcs11, which it describes as "an independent, third-party project, not affiliated with or endorsed by osslsigncode". That module reads your Certum account email and a one-time-password seed from environment variables, so it holds the keys to your signing account: review it before you give it those. Where to run the signing step and how to gate it in a pipeline is covered in code signing in CI/CD.
How do you check the signature and its timestamp?
Run osslsigncode verify on the signed file and check the line Timestamp Server Signature verification: ok, not just the exit code. The timestamp is what keeps a shipped file valid after the certificate expires; Microsoft puts it plainly: "Without a time stamp, the signature becomes invalid when the signing certificate expires." Code signing certificates issued since March 1, 2026 last at most 460 days, so that expiry comes round quickly.
osslsigncode verify -CAfile test-ca.pem -in app-signed.exe
# (our test network blocked the CRL download, so we also passed
# Certum's timestamp CRL with -TSA-CRLfile)
# Output from our test (trimmed):
Countersignatures:
Timestamp time: Nov 12 08:53:48 2026 GMT
Issuer: /C=PL/O=Asseco Data Systems S.A./CN=Certum Timestamping 2021 CA
Timestamp Server Signature CRL verification: ok
Timestamp Server Signature verification: ok
Signature verification: ok
Number of verified signatures: 1
SucceededWith osslsigncode 2.9, the version we tested, two other runs also printed Succeeded and exited 0. A file signed without -ts reported Timestamp is not available. A properly timestamped file checked on a machine that couldn't download Certum's timestamp CRL reported Timestamp Server Signature verification: failed, and osslsigncode suggested -TSA-CRLfile to supply the CRL by hand. The 2.15 release notes say verify now reports failure when timestamp verification fails; they say nothing about files with no timestamp at all, so keep the check below on every version. A forgotten timestamp can be added afterwards with osslsigncode add -ts http://time.certum.pl -in app-signed.exe -out app-timestamped.exe, which worked in our test.
osslsigncode verify -in app-signed.exe > verify.log 2>&1
grep -q '^Timestamp Server Signature verification: ok' verify.log \
&& grep -q '^Signature verification: ok' verify.log \
|| { echo "signature or timestamp not verified"; exit 1; }Leave out -CAfile for a real certificate: osslsigncode then checks the chain against the system CA bundle (/etc/ssl/certs/ca-certificates.crt on Debian). Against that bundle our self-signed test certificate failed with Error: self-signed certificate and exit code 1, which is the result you want for an untrusted signer. Why the timestamp outlives the certificate is explained in our guide to code signing timestamps, and the Windows-side checks are in how to verify a code signature.
What do the common osslsigncode errors mean?
Most osslsigncode failures on Linux come from a wrong module path, a URI that matches no object, a wrong PIN, an unreachable timestamp server or a leftover output file. These are the messages each one produced in our test, first lines only. On osslsigncode 2.9 every one exited with a non-zero code and wrote no output file; the Ubuntu 24.04 crash in the last row is the exception that leaves a partial file.
| Message | Cause | Fix |
|---|---|---|
Unable to load module /usr/lib/…/pkcs11.so | The -pkcs11module path doesn't exist or a library it needs is missing | Install the token middleware and use the path you pass to p11tool --provider |
The certificate was not found at: pkcs11:… | The URI names a label the token doesn't have | Copy object= and token= from p11tool --list-all --login |
Login failed … PIN incorrect | Wrong PIN in -pass or the -readpass file | Check the PIN secret before retrying |
RFC 3161 timestamping failed | The timestamp server couldn't be reached or answered with something else | Allow outbound HTTP from the build machine to the timestamp host |
Overwriting an existing file is not supported. | -out already exists, or equals -in | Delete the leftover file or write to a new name |
Segmentation fault (exit 139) | Ubuntu 24.04's pkcs11 engine (bug 2119094) | Sign in a Debian 13 container; delete the half-written output first |
One message points the wrong way. When -ts fails, osslsigncode suggests trying -t instead; in our test the cause was simply an unreachable host, and switching flags wouldn't have helped. If a signature verifies on your machine but Windows users still see an unknown publisher, the certificate is self-signed or internal: only a certificate that chains to a publicly trusted CA is trusted on other people's machines.
Frequently Asked Questions
Quick answers to related questions.
Which file types can osslsigncode sign?
According to the osslsigncode README, it signs and timestamps PE files (EXE, DLL, SYS), CAB, CAT, MSI and APPX files, plus PowerShell script files (.ps1, .ps1xml, .psc1, .psd1, .psm1, .cdxml), .mof files and JavaScript (.js). PowerShell signing arrived in version 2.8 and JavaScript in 2.10, so an older distribution package may not handle them.
What is the difference between -t and -ts in osslsigncode?
The -t option adds a legacy Authenticode timestamp and -ts adds an RFC 3161 timestamp; osslsigncode refuses to combine them in one command. Certum's server at http://time.certum.pl answered both in our November 2026 test. This guide uses -ts. Whichever you pick, add a timestamp: Microsoft says that without one the signature becomes invalid when the signing certificate expires.
Do I still need a hardware token to sign on Linux?
For a publicly trusted certificate, yes. Since June 1, 2023 the CA/Browser Forum code signing rules require the private key to be generated, stored and used in hardware certified to at least FIPS 140-2 Level 2 or Common Criteria EAL 4+: a token, your own HSM, or a cloud signing service. osslsigncode still signs with a .p12 file, which is fine for a self-signed test certificate but not how a public CA delivers code signing keys any more.
Can osslsigncode sign on macOS?
Yes, the tool is available on macOS through Homebrew (brew install osslsigncode), which listed version 2.15 in November 2026. The commands are the same as on Linux. We ran the tests on this page on Debian 13 and Ubuntu 24.04 only, not on a Mac.
Can osslsigncode sign with a Certum SimplySign cloud certificate?
Certum doesn't document it and we haven't tested it, so treat it as possible, not promised. SimplySign Desktop emulates a smart card and reader while the key stays in Certum's cloud, but Certum's signing manual covers signtool and jarsigner on Windows only and names a PKCS#11 library only for Windows. Connecting takes a code from the SimplySign mobile app, and the Linux build of SimplySign Desktop needs a graphical desktop (Cinnamon, MATE or KDE Plasma). The osslsigncode README also names a third-party PKCS#11 module for SimplySign that it does not endorse.
Need the certificate osslsigncode signs with?
osslsigncode does the signing; the trust comes from the certificate behind it. My-SSL sells Certum Standard and EV code signing certificates. Certum is a publicly trusted certificate authority, the key is held in Certum's SimplySign cloud service, and no USB token is shipped, so check the SimplySign section above against your build setup first. Compare terms on the code signing certificates page; if a registered company needs extended validation, the EV code signing certificate page lists what Certum asks the organization for.