0
我想导入PFX certificate
使用certutil.exe
。当我使用这个过程:导入无密码PFX引发异常
Process.Start(
new ProcessStartInfo()
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "certutil",
Arguments = string.Format("-f -p {0} -importPFX \"{1}\"", passwordPFX, _pathServerCerPFX)
}
).WaitForExit();
它工作正常的一切。 (在这种情况下,证书是使用密码创建的)。但是,如果我没有密码创建证书,并尝试导入这样的:
Process.Start(
new ProcessStartInfo()
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "certutil",
Arguments = string.Format("-f -p -importPFX \"{0}\"", _pathServerCerPFX)
}
).WaitForExit();
然后我得到一个错误,指出:A specified logon session does not exist. It may already have been terminted.
什么可能我会丢失?
虽然转义-p,我仍然得到提示等待我输入密码。你如何在代码中绕过这个提示? – qingjinlyc