osslsigncode is a small tool that implements part of the functionality of the Microsoft tool signtool.exe
osslsigncode Description
Primary Purpose:
osslsigncode is a tool designed to provide Authenticode signing and timestamping functionality, similar to Microsoft's signtool.exe but based on OpenSSL and cURL. It enables cross-platform code signing for PE (EXE/SYS/DLL/etc), MSI, CAB files, and Java CAB files.
Key Features:
Supports signing of PE, MSI, CAB, and Java CAB files.
Implements functionality similar to signtool.exe's "-j javasign.dll -jp low".
Integrates with OpenSSL and cURL for compatibility across various platforms.
Handles timestamping through proxies.
Works with certificates in SPC, PEM, PKCS#12 formats and supports PKCS#11 tokens.
Audience & Benefits:
Ideal for developers needing to sign binaries on non-Windows platforms. It simplifies the process of cross-platform development by avoiding reliance on Windows-specific tools. osslsigncode allows for efficient code signing without the constraints of traditional Windows-based solutions, enhancing workflow and flexibility in software development.
This tool can be installed via winget, ensuring ease of setup across supported environments.
README
osslsigncode
BUILD STATUS
WHAT IS IT?
osslsigncode is a small tool that implements part of the functionality
of the Microsoft tool signtool.exe - more exactly the Authenticode
signing and timestamping. But osslsigncode is based on OpenSSL and cURL,
and thus should be able to compile on most platforms where these exist.
WHY?
Why not use signtool.exe? Because I don't want to go to a Windows
machine every time I need to sign a binary - I can compile and build
the binaries using Wine on my Linux machine, but I can't sign them
since the signtool.exe makes good use of the CryptoAPI in Windows, and
these APIs aren't (yet?) fully implemented in Wine, so the signtool.exe
tool would fail. And, so, osslsigncode was born.
WHAT CAN IT DO?
It can sign and timestamp PE (EXE/SYS/DLL/etc), CAB, CAT, MSI and APPX files,
as well as script files with extensions .ps1, .ps1xml, .psc1, .psd1,
.psm1, .cdxml, .mof, and .js.
It supports the equivalent of signtool.exe's "-j javasign.dll -jp low",
i.e. add a valid signature for a CAB file containing Java files.
It supports getting the timestamp through a proxy as well. It also
supports signature verification, removal and extraction.
BUILDING
This section covers building osslsigncode for Unix-like operating systems.
See INSTALL.W32.md for Windows notes.
We highly recommend downloading a release tarball instead of cloning from a git repository.
Configure, build, make tests and install osslsigncode
Install prerequisites on a Debian-based distributions, such as Ubuntu:
To sign with osslsigncode you need the certificate file mentioned in the
article above, in SPC or PEM format, and you will also need the private
key which must be a key file in DER or PEM format, or if osslsigncode was
compiled against OpenSSL 1.0.0 or later, in PVK format.
You can check that the signed file is correct by right-clicking
on it in Windows and choose Properties --> Digital Signatures,
and then choose the signature from the list, and click on
Details. You should then be presented with a dialog that says
amongst other things that "This digital signature is OK".
UNAUTHENTICATED BLOBS
The "-addUnauthenticatedBlob" parameter adds a 1024-byte unauthenticated blob
of data to the signature in the same area as the timestamp. This can be used
while signing, while timestamping, after a file has been code signed, or by
itself. This technique (but not this project) is used by Dropbox, GoToMeeting,
and Summit Route.
This feature allows for doing dumb things. Be very careful with what you put
in the unauthenticated blob, as an attacker could modify this. Do NOT, under
any circumstances, put a URL here that you will use to download an additional
file. If you do that, you would need to check the newly downloaded file is
code signed AND that it has been signed with your cert AND that it is the
version you expect.
BUT, if you have questions related to generating spc files,
converting between different formats and so on, please
spend a few minutes searching on google for your particular
problem since many people probably already have had your
problem and solved it as well.