GitHunt
GE

Genbox/FastCodeSign

A cross-platform code signing library for Windows Authenticode (Windows executables & PowerShell) and macOS code signatures

FastCodeSign

NuGet
License

Description

A cross-platform code signing library for Windows Authenticode (Windows executables & PowerShell) and macOS code signatures.
Has no external dependencies and has a simple one-shot API that auto-detects file format.

Features

Example

internal static class Program
{
    private static void Main()
    {
        byte[] pwsh = """
                      Write-Host "Hello world!"
                      """u8.ToArray();

        // You need to provide a code signing certificate
        X509Certificate2 cert = X509CertificateLoader.LoadPkcs12FromFile("FastCodeSign.pfx", "password");

        // We set the filename, only to make it easier for the file format detection to select the right signer
        Span<byte> signed = CodeSign.SignData(pwsh, cert, fileName: "script.ps1");
        Console.WriteLine(Encoding.UTF8.GetString(signed));
    }
}

Output:

Write-Host "Hello world!"
# SIG # Begin signature block
# MIIIiwYJKoZIhvcNAQcCoIIIfDCCCHgCAQMxDTALBglghkgBZQMEAgEwewYKKwYB
# BAGCNwIBBKBtBGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# <truncated for brevity>
# X59J9Shad7x2+oeU+7bRggn6aqJXcUeA36zmMcY8VwesOTRDth06bD4QzoP3uOSm
# tKO4SXHci/UEJNK/0fYOUcI1pBm6hgY/5tG/pBwVLrPhOhFw3OTpfFrkAldNCAn7
# uFlJfKDOoPk39t3kA7d+/A1Nj++kn2UaF1GLfId6Gw==
# SIG # End signature block

Filetype support

Authenticode

Windows portable executables:

  • exe: Windows Portable Executable files
  • dll: Windows Dynamic Link Library files
  • sys: Windows System files
  • scr; Windows Screensaver files
  • ocx: Windows ActiveX control files
  • cpl: Windows Control Panel applet files
  • mun: Windows resource-only files
  • mui: Windows language resource files
  • drv: Windows driver files
  • winmd: Windows Runtime Metadata files
  • ax: Windows DirectShow filters
  • efi: UEFI application/driver files

PowerShell files:

  • ps1: PowerShell script files
  • psm1: PowerShell module files
  • psd1: PowerShell data files
  • ps1xml: PowerShell XML files
  • psc1: PowerShell Console files
  • cdxml: PowerShell cmdlet definition XML files

macOS code sign

  • Mach Object files

Not supported

  • dmg/pkg/app: Bundle files for macOS
  • cat: Catalog Security file
  • manifest: Application manifest file
  • application: ClickOnce deployment manifest file
  • xap: Silverlight Application file
  • msi: Windows Installer file
  • cab: Windows Cabinet file

Contributors

MIT License
Created September 13, 2025
Updated December 19, 2025
Genbox/FastCodeSign | GitHunt