Share via

How to sign ClickOnce artifacts when using Google Cloud KMS for code signing?

Darshana Dilhan 0 Reputation points
2025-07-24T16:36:09.0733333+00:00

I've successfully done code signing using Google Cloud KMS and jsign for executable files, but I'm unable to sign ClickOnce manifest files.

Current Setup

  • Certificate: Code signing certificate from Sectigo (in .crt format)
  • Private Key: Stored in Google Cloud KMS (cannot be exported)
  • Signing Tool: jsign 7.1 (works perfectly for .exe files)

I’ve already tried signtool.exe, but it returns the error:

"This file format cannot be signed because it is not recognized" — for manifest files.

🔒 Note: I cannot use a .pfx file or sign via Visual Studio because Google Cloud KMS does not expose private keys.

Any guidance on tools, workflows, or workarounds would be greatly appreciated! Thanks.

Developer technologies | Windows Forms
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Darshana Dilhan 0 Reputation points
    2026-01-09T17:25:22.4566667+00:00

    I finally resolved this using Relic (a standalone signing tool by SAS) and Mage. The key is the specific order of operations:

    Use mage -update on the .manifest.

    Sign the .manifest with Relic (which supports GCP KMS natively).

    Use mage -update -AppManifest on the .application file to link the newly signed manifest.

    Finally, sign the .application and .exe files with Relic.

    This 'Sign -> Update -> Sign' sequence prevents the HashValidation and IdentityMismatch errors common when switching to KMS-backed certificates.

    0 comments No comments

  2. Gade Harika (INFOSYS LIMITED) 2,590 Reputation points Microsoft External Staff
    2025-07-25T04:42:11.39+00:00

    Thank you for sharing the details.

    your setup with Google Cloud KMS and jsign is impressive! You're absolutely right: signing ClickOnce manifest files is a bit more complicated due to the format and the limitations of tools like SignTool and Mage, which expect access to a .pfx file or a certificate in the local store.

    The Core Issue

    jsign doesn't support .application or .manifest files.

    SignTool and Mage require a .pfx or a cert in the Windows cert store.

    Google Cloud KMS keeps the private key non-exportable, so .pfx creation is off the table.

    Possible Workarounds

    1. Use Google Cloud KMS CNG Provider

    Google offers a CNG provider that allows SignTool to access KMS-backed keys directly. You’ll need:

    The latest Windows SDK (for SignTool)

    The Google Cloud KMS CNG provider installed

    Your certificate imported into the Windows cert store (without the private key)

    Then you can use SignTool like this:

    powershell

    signtool sign /v /fd sha256 /csp "Google Cloud KMS Provider" /kc <KMS key path> <artifact>

    However, this still won’t help with .manifest files unless Mage can also use the CNG provider—which it currently doesn’t.

    1. Custom Signing Workflow

    Since Mage requires a .pfx, consider creating a custom signing tool that:

    Uses the Google Cloud KMS API to sign the manifest hash

    Injects the signature manually into the manifest XML

    This is advanced, but doable. You’d need to:

    Extract the hash from the manifest

    Sign it using the KMS asymmetric key via the API

    Embed the signature back into the manifest

    1. Hybrid CI/CD Pipeline

    If you’re using a CI/CD system like Azure DevOps or GitHub Actions:

    Use a self-hosted agent with access to the KMS key

    Use a script like SignClickOnceApp.ps1 to sign the .exe with SignTool and the manifest with Mage

    Modify the script to call Google Cloud KMS for signing instead of using a .pfx

    Let us know if the issue persists after following these steps. We’ll be happy to assist further if needed. If the issue has been resolved, kindly mark the response as answered."


  3. david_son12 5 Reputation points
    2025-07-25T04:32:30.68+00:00

    I've recently purchased a code signing cert for Google Cloud KMS. I followed this step for configuration and signing. Just check if it works for you, then: https://signmycode.com/resources/sectigo-code-signing-implementations-on-google-kms-key-management-service


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.