当组策略在 windows 中设置强密钥保护时,对 UI 提示有什么影响?

What is the effect on UI Prompts when group policy sets strong key protection in windows?

我正在尝试 避免使用 windows 对话框并通过我自己的代码输入证书私钥的密码。

我可以使用存储在智能卡上的证书来完成此操作,但无法使用存储在 PC 中的证书。我的问题是为什么?

我在 this article it is explained the required process. 中看到我们的组策略已为我们儿童用户设置。当我们导入证书时,我们得到这个 window.

当我们在 Outlook 中使用证书时,可以看到

进一步在安全选项下的组策略中 "Force strong key protection for user keys stored on the computer" 有 "User Must enter a password each time they use a key" 意思是每次我阅读电子邮件并且它需要这样的证书我需要输入密码。

对于我一个低级的 .net 程序员来说,这些事情意味着用户每次都必须输入密码,但是在 windows/security 人说话中这是否也意味着 windows 必须提供 UI 去做吗?换句话说,当我尝试为其证书存储在 PC 上的密钥添加密码时,它失败了。

如果到目前为止我是正确的,那么解决方法是什么。证书能否以文件形式保存并使用?它可以保存在数据库中并检索吗?或者是存储在智能卡上的唯一真正替代方案,而政策似乎有所不同。

does this also mean that windows must supply the UI to do it?

是的,操作系统将显示私钥访问对话框(同意提示或密码输入对话框)。

In other words when I attempt to add a password for a key whose certificate is stored on the PC it fails.

不清楚到底是什么失败了。你得到什么错误信息?在什么条件下?

IIRC,您无法在策略实施后向已安装的证书添加密码。当您强制执行该政策时,只有 generated/requested 个新证书需要用户输入。从 PFX 导入时,有一个选项可以指定密钥保护标志。但是一旦安装了证书,就无法更改此设置。