-
Notifications
You must be signed in to change notification settings - Fork 58
ClickOnce EV code sign with USB HSM add support for EDCSA keys #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I see multiple potential issues here:
|
It's possible that the certificate @RhomGit is using has an elliptic curve key, then this is not supported by mage, as it has RSA providers hardcoded in places. In this case your best option is to request a new key. @RhomGit - to eliminate the easy case, are you using a 64 bit version of mage? Does 64 vs 32 bits make a difference? |
It was 32 bit. I saw your previous post and downloaded the https://dotnet.microsoft.com/en-us/download/dotnet-framework/thank-you/net481-developer-pack-offline-installer and it did indeed place a mage.exe in the x64 subfolder in the Program Files (x86) directory :) I am heading out to the office now to test (as you can't use the keys over RDP). I will post back soon! |
You would want the latest version as some fixes related to HSM were shipped over time. To answer your other questions - where to get the .cer file. You should be able to export the public key from your hardware. Perhaps the crypto provider adapter suggests a different file extension for the exported file. For example, Yubico UI suggests .crt or .pem extensions, you can change this extension when exporting. To find out if your key is a signature or an exchange key, run the
The important piece is
Your fastest option is to either request a new certificate or to follow this workaround - Signing using MAGE fails when providing -CertFile -CryptoProvider and -KeyContainer · Issue #986 · microsoft/dotnet (github.com) |
Alas, I tried x64 and still get this:
I have updated to latest YubiKey Manager. Re-downloaded and re-imported the key and still the same results. I contacted SSL.com to see about a new certificate and finally got a decent response from them. I am opting for OV for now since I am in such a predicament with a wide user base. Note: I have had issues with eSigner and refuse to use it ever again. As recommended I have added this a feature request: https://developercommunity.visualstudio.com/t/Add-support-to-ClickOnceMAGE-for-certif/10320755?port=1026&fsid=a18cb832-d063-456d-84c4-51e0dfcabdf2 Thanks |
@RhomGit thank you for the details. So your actual request is for mage and ClickOnce to support EDCSA. I'll modify the bug title accordingly. |
Hi, @Tanya-Solyanik I am sorry to say that this continues to be a thorn in our business. OV has unfortunately not been a viable solution as now many of our client organisations are being confronted with SmartScreen (which is embarrassing and confusing to users) and some are having to engage their own I.T departments to workaround the solution every time we publish an update. I appreciate all of your consideration up to this point however I need to make a serious decision on this so if I could please have some information to go by:
I do value and appreciate your responses thus far. Thanks, |
We have decided to engage with alternate CA's to find one that still supports the older RSA method. |
For anyone trying to use EVCS with ClickOnce I'll keep a list of here of engaged CAs trying to find someone who still supports KeySpec = 2.
SSL.comYubikey was KeySpec = 0 as above. GlobalSignresponse was: DigicertNote: many CA seems to use digicert (including Thawte) |
Was any resolution reached on this? We have ClickOnce apps as well and need to be able to sign them in a way that shows publisher. We use Azure HSM Key Vault for our cert and it works fine using AzureSignTool to sign the DLLs/EXEs -- but not sure how to handle the ClickOnce manifest signing. |
I moved to Digicert as my CA who supports KeySpec==2 via physical HSM and published to ClickOnce via Visual Studio directly. There are instructions here: https://github.com/dotnet/sign for AzureSignTool + ClickOnce support. |
Actually it seems like Command.cs only supports value After building this repo, the following works for me:
This is using a HARICA code signing certificate, which has spec AT_KEYEXCHANGE. |
@plutext Did you modify the Command.cs file, or use the current version of the repo as is? Looking at the history of Command.cs, I don't see what has changed that would make |
Same issue here, ubikey with EV certificate. Following this thread and hopefully mage.exe can be updated to support the EV certificates as well. |
Almost a year later, is this support even on Microsoft's roadmap? Given that signtool can work work these certificates, why can't a dev be assigned to fix dotnet-mage to use the same? Is ClickOnce no longer a recommended technology from Microsoft? |
Does anyone have a working way to sign manifests using RuToken v 3.0 (Global Sign)? |
Description
I am manually signing application manifest via mage.exe or mageui.exe.

I have an EVCS from a CA issued on a USB HSM (Yubikey).
signtool.exe has signed the executable correctly using the HSM.
mage.exe is reporting "This certificate does not contain a private key"
mageui.exe is asking for a Certificate file which I don't have.
To Reproduce
Try and sign a manifest file using a USB HSM.
Exceptions (if any)
"This certificate does not contain a private key"
Configuration
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8.1 Tools>
Other information
I have a ticket open with Visual Studio here: https://developercommunity.visualstudio.com/t/ClickOnce-EV-Signing-with-HSM/10278648
I can use signtool to successfully use the HSM for EVCS. This works and I just need mage to do the same. I run the following in PowerShell which prompts for PIN and works perfectly:
Some others have reverse engineered mage to get this working: https://stackoverflow.com/questions/54752638/mage-exe-manifest-signing-with-certificate-stored-in-aws-cloudhsm
I am happy to help give more feedback/troubleshooting to help resolve this issue. It is affecting many of our clients (today has been awful) as its been sitting triaged for 3 weeks in the other forum and this looks like the appropriate repo for mage. Thanks
The text was updated successfully, but these errors were encountered: