我試圖枚舉服務器上的證書存儲並獲取有關每個證書的信息。該代碼正常工作,但缺少在「中級證書頒發機構」商店中找到的所有證書。枚舉證書問題(X509Certificate2)
string[] stores = new string[] { "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", "TrustedPublisher" };
for (int x = 0; x < stores.Length; x++)
{
X509Store store = new X509Store(stores[x],StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
foreach (X509Certificate2 mCert in store.Certificates)
{
//handle certificates
}
}
「中級證書頒發機構」的store.Certificates集合是否爲空? – Hans 2012-01-30 20:21:49