2 unstable releases
Uses new Rust 2024
| new 0.2.0 | Mar 6, 2026 |
|---|---|
| 0.1.0 | Mar 4, 2026 |
#1097 in Development tools
Used in cargo-code-sign
54KB
995 lines
native-code-sign
Code signing wrappers using platform-native signing tools.
macOS
Uses Apple's codesign tool.
Set the following environment variables:
CODE_SIGN_IDENTITY: signing identity (e.g. "Developer ID Application: ...")CODE_SIGN_CERTIFICATE: base64-encoded .p12 certificateCODE_SIGN_CERTIFICATE_PASSWORD: password for the .p12CODE_SIGN_OPTIONS: (optional) extra--optionsvalue (e.g.runtimefor hardened runtime / notarization)CODE_SIGN_ALLOW_UNTRUSTED: (optional) set to1/trueto allow self-signed certs not in system trust
An ephemeral keychain is used to store the certificate, temporarily modifying the keychain search
list. This modification is robust to concurrent cargo-code-sign invocations, but not to other
programs modifying the keychain search list.
Windows
Uses Microsoft signtool.exe.
Local certificate signing (.pfx)
Set the following environment variables:
CODE_SIGN_CERTIFICATE_PATH: path to a .pfx certificate fileCODE_SIGN_CERTIFICATE_PASSWORD: password for the .pfxCODE_SIGN_TIMESTAMP_URL: (optional) RFC 3161 timestamp server URLCODE_SIGN_DESCRIPTION: (optional) description shown in UAC prompts (signtool/dflag)CODE_SIGN_TOOL_PATH: (optional) path to signtool.exe (defaults tosigntool.exefromPATH)
Azure Trusted Signing
Set all of:
CODE_SIGN_AZURE_DLIB_PATH: path toAzure.CodeSigning.Dlib.dllCODE_SIGN_AZURE_ENDPOINT: Artifact Signing endpoint (for examplehttps://eus.codesigning.azure.net)CODE_SIGN_AZURE_ACCOUNT:CodeSigningAccountNameCODE_SIGN_AZURE_CERTIFICATE_PROFILE:CertificateProfileName
Optional:
CODE_SIGN_AZURE_CORRELATION_ID: correlation ID for request tracingCODE_SIGN_TIMESTAMP_URL: RFC 3161 timestamp URL (defaults tohttp://timestamp.acs.microsoft.com)CODE_SIGN_DESCRIPTION: description shown in UAC prompts (/d)CODE_SIGN_TOOL_PATH: explicit path tosigntool.exe
Azure authentication is handled by the dlib via DefaultAzureCredential.
Dependencies
~7–15MB
~221K SLoC