gpt4 book ai didi

c# - Sn.exe自动输入密码

转载 作者:太空狗 更新时间:2023-10-29 20:22:23 24 4
gpt4 key购买 nike

我需要创建后期构建事件来执行以下操作:

sn -i MyKey.pfx MyKeyContainerName
tlbimp $(ConfigurationName)\MyCom.tlb /out:$(ConfigurationName)\NETMyCom.dll /keycontainer:MyKeyContainerName
sn -d MyKeyContainerName

当 Visual Studio 执行第一条语句时,它需要密码并等待直到用户指定它并失败。

Microsoft (R) .NET Framework Strong Name Utility Version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.

Enter the password for the PKCS#12 key file: Failed to parse the PKCS#12 blob in mykey.pfx -- The handle is invalid.

我尝试使用 sn 命令行参数指定密码,但我找不到执行此操作的方法。

请帮忙。

问候,希尔米。

最佳答案

不幸的是,这里提到的方法都不适合我。我必须在 docker 容器中注册几个 pfx。

所以我重新开发了 sn.exe -i <infile> <container>在 C# 中使用 RSACryptoServiceProvider 命令.源代码和应用程​​序在 GitHub 上SnInstallPfx项目。

SnInstallPfx应用程序接受 PFX key 及其密码。它自动计算 key 容器名称 (VS_KEY_*)(借用自 MSBuild 源代码)并将其安装到强名称 CSP。

用法:

SnInstallPfx.exe <pfx_infile> <pfx_password>

关于c# - Sn.exe自动输入密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3138106/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com