SignerSignEx as the Azure WebJob

本文关键字:WebJob Azure the as SignerSignEx | 更新日期: 2023-09-27 18:21:56

我在C#上发现了SignerSignEx的绝妙用法:https://stackoverflow.com/a/26372061

它在开发机器上运行良好,但在Azure WebJob上,你必须使用这样的东西:

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

但带有X509KeyStorageFlags.MachineKeySet标志的SignerSignEx返回hResult=-2146885626(错误代码0x80092006-未为存储或对象指定提供程序。)

我如何修复它,以及为什么MachineKeySet对提供程序有影响?谢谢

SignerSignEx as the Azure WebJob

经过一些研究,我几乎可以肯定(99%:))SignerSignEx在没有用户配置文件的情况下是不起作用的。所以我使用mono+openssl。

看起来像是一个解决方案。

您可以在以下位置看到使用Mono的authenticode示例:https://github.com/mono/mono/blob/master/mcs/tools/security/signcode.cs

再见,祝你过得愉快!