adxpublisher.exe doesn't support CNG certificates?

Add-in Express™ Support Service
That's what is more important than anything else

adxpublisher.exe doesn't support CNG certificates?
Using adxpublisher give me "Publisher failed. Invalid provider type specified." 
jaklug




Posts: 11
Joined: 2018-08-28
It seems that my code signing certificate isn't supported by Add-in Express for Office and .NET. When I run adxpubliher with it, I get this output:

Publisher: Preparing files...
Done.
Publisher: Checking the certificate...

Publisher failed. Invalid provider type specified.

Publisher error (stack trace): at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
at AddinExpress.Projects.Common.Certificate.HasPrivateKey(X509Certificate2 cert)
at AddinExpress.Deployment.ClickTwicePublisher.ValidateCertificate(X509Certificate2 cert, String hashOrPath)
at AddinExpress.Deployment.ClickTwicePublisher.Run()
at AddinExpress.Deployment.Program.Main(String[] args)

When I try using the VS plugin to set the signing options, when I select my certificate from the store I get a dialog saying "Add-in Express Visual Studio Package encountered an exception. You can get morwe information by examining the add-in-express-package-log.txt log file."

The contents of the log file are:

<LogEntry Date="2022-03-11 11:48:10" Severity="Exception" Source="AddinExpress.Projects.Common.SignForm.LoadCertificateFromStore" ProcessId="28968">
<Exception Type="System.Security.Cryptography.CryptographicException" Source="AddinExpress.Projects.Common.SignForm.ValidateCertificate">
<Message>Only certificates using CSP Storage Provider are supported. </Message>
<StackTrace> at AddinExpress.Projects.Common.SignForm.ValidateCertificate(X509Certificate2 cert, String hashOrPath)
at AddinExpress.Projects.Common.SignForm.LoadCertificateFromStore(String hash)</StackTrace>
</Exception>
</LogEntry>

Why don't you support CNG certificates? This particular certificate is only about a year old. It should work with any current signing application.

Thanks,

Joe
Posted 11 Mar, 2022 14:59:30 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Joe,

Yes, these certificates aren't supported. A workaround that only applies to ClickTwice-based deployment is given at https://www.add-in-express.com/forum/read.php?FID=5&TID=16307&MID=84617#message84617.

Also, at https://stackoverflow.com/questions/51739470/invalid-provider-type-specified-error-in-code-signing-the-vsto-outlook-applicati, someone provides an instruction that may or may not be useful/applicable to you. We don't have such a certificate and we can't check the instruction. Also, my understanding of certificates is far from ideal so I can't even check if the instruction looks like a correct one.

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 14 Mar, 2022 08:06:35 Top
jaklug




Posts: 11
Joined: 2018-08-28
Thanks for the response. However, in the workaround, I still need to supply a certificate in this step:

"C:\Program Files (x86)\Add-in Express\Add-in Express for .NET\Bin\adxpublisher.exe" /OutputType=ClickTwice /WorkingDirectory="D:\Temp\MyAddin89\MyAddin89\Configs\ClickTwice\1033\1.0.0" /ConfigFile="adxpublisher.exe.config"

Can I execute adxpublisher.exe without setting a certificate in the config file? And if I still need a certificate, how does the workaround help?

Joe
Posted 15 Mar, 2022 15:19:09 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Joe,

Andrei Smolin writes:
I still need to supply a certificate in this step


Use a test certificate; Add-in Express allows you to create a new certificate. The subsequent steps overtrite the test certificate on binaries.

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Mar, 2022 09:39:34 Top