SignerSignEx as the Azure WebJob

0

I found a brilliant use of SignerSignEx on C# here: https://stackoverflow.com/a/26372061

It works fine on the dev. machine, but on Azure WebJob you have to use something like this:

X509Certificate2 cert = new X509Certificate2(certPath, 
                        certPassword, 
                        X509KeyStorageFlags.MachineKeySet |
                        X509KeyStorageFlags.PersistKeySet |
                        X509KeyStorageFlags.Exportable);

But with X509KeyStorageFlags.MachineKeySet flag SignerSignEx returns hResult=-2146885626 (Error code 0x80092006 - No provider was specified for the store or object.)

How I can fix it and why MachineKeySet has influence on provider ? Thanks!

c#
azure
sign
cryptoapi
webjob
asked on Stack Overflow Nov 13, 2015 by Volodymyr Karpus • edited May 23, 2017 by Community

1 Answer

0

After some research I almost sure (99% :) ) that SignerSignEx just doesn't work without user's profile. So I used mono + openssl.

Looks like a solution.

You can see an example of authenticode with Mono at: https://github.com/mono/mono/blob/master/mcs/tools/security/signcode.cs

Bye, have a beautiful time!

answered on Stack Overflow Nov 16, 2015 by Volodymyr Karpus

User contributions licensed under CC BY-SA 3.0