我的 .NET 程序集使用来自 comodo 的数字证书进行签名。我使用 SGEN 生成序列化程序集。SGEN 需要一个密钥文件才能为已签名的源生成此类程序集。我尝试了以下几行:
sgen.exe /force /parsableerrors /compiler:/keyfile:"mycert.pfx" "myproduct.exe"
但这说我
SGEN: error SGEN1: Unable to generate a temporary class (result=1).
error CS1548: Cryptographic failure while signing assembly' -- 'Key file 'mycert.pfx'
- Bad Version of provider.
我尝试使用 SN -p mycert.pfx mycert.snk 然后获得肯定可以用于 SGEN 的 .snk
sgen.exe /force /parsableerrors /compiler:/keyfile:"mykey.snk" "myproduct.exe"
但这说我
SGEN: error SGEN1: Unable to generate a temporary class (result=1).
error CS1548: Cryptographic failure while signing assembly' --
'Key file 'mykey.snk' is missing the private key needed for signing'
我在互联网上读到这是 SGEN 错误,它不能使用 pfx 对程序集进行签名。那么我能做什么呢?我可以从 pfx 中提取私钥到 snk 文件吗?