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!