通过程序化方式从Verisign等特定CA在线验证认证X509

时间:2017-04-27 13:35:34

标签: c# ssl x509certificate x509certificate2 ca

我想获取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; }

0 个答案:

没有答案