【问题标题】:Powershell to insert PFX into IIS, SmartCard Prompt IssuePowershell 将 PFX 插入 IIS,智能卡提示问题
【发布时间】:2018-07-26 02:09:12
【问题描述】:

我有一个试图通过 Powershell 插入的 PFX。

Import-PfxCertificate –FilePath $certPath -CertStoreLocation cert:\LocalMachine\My -Password $securePassword

我在 powershell 中使用 Import-PfxCertificate cmdlet,它可以工作,只是它会在我执行此操作时提示我有关 SmartCard 的信息。我在智能卡提示符上按取消,一切顺利。我似乎无法抑制或绕过它。我只是想导入到 cert:\LocalMachine\My,没什么疯狂的。

我可以通过转到 PFX、右键单击并安装 PFX 来复制提示。完成向导后,如果我选择允许 Windows 选择商店,我会得到提示,如果我手动选择商店,我不会。我假设我在 powershell 脚本中设置证书路径会产生相同的效果,但我还没有解决它。我想知道我是否以一种感觉它与智能卡相关的方式生成了 pfx。

SmartCard 服务在机器上被禁用,这使得这更有趣。任何见解将不胜感激。

谢谢,

【问题讨论】:

    标签: powershell smartcard pfx


    【解决方案1】:

    我遇到了同样的问题,对我来说,这是由于从机器导出的证书不正确。证书缺少私钥或格式不正确。

    我通过使用以下代码导出证书来解决此问题,新的证书运行良好。 https://github.com/OBeautifulCode/OBeautifulCode.Security/blob/master/OBeautifulCode.Security/CertHelper.cs

    方法:ExportPfxFromCertificateStoreToFile

    【讨论】:

      猜你喜欢
      • 2014-07-12
      • 1970-01-01
      • 2010-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多