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