我想获取X509Certificate2认证并访问在线CA并检查它是否真实...我注意到C#中的代码做了类似的事情,但我不知道它如何在线访问以及它访问哪个CA我希望任何人帮助我,,,,代码就在这里
X509Chain chain = new X509Chain();
X509ChainPolicy chainPolicy = new X509ChainPolicy()
{
RevocationMode = X509RevocationMode.Online,
RevocationFlag = X509RevocationFlag.EntireChain
};
chain.ChainPolicy = chainPolicy;
if (!chain.Build(x509))
{
foreach (X509ChainElement chainElement in chain.ChainElements)
{
foreach (X509ChainStatus chainStatus in chainElement.ChainElementStatus)
{
Console.WriteLine(chainStatus.StatusInformation);
}
}
return false;
}
else { return true; }