vallamreddy.supraja@gmail.com:
but it is not checking online properly. could you please help me any one .
Hi
X509Chain is used for certificate validation and give a global error status inside ChainStatus. Here is the verification used to check the Certificate revocation status performed online. Hope it helps
X509Store store = new X509Store("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
//Output store information.
string output = "";
output = "Store Information";
output += "Number of certificates in the store: " + store.Certificates.Count;
output += "Store location: " + store.Location;
output += "Store name: " + store.Name + " " + Environment.NewLine;
//Put certificates from the store into a collection so user can select one.
X509Certificate2Collection fcollection = (X509Certificate2Collection)store.Certificates;
X509Certificate2Collection collection = X509Certificate2UI.SelectFromCollection(fcollection, "Select an X509 Certificate", "Choose a certificate to examine.", X509SelectionFlag.SingleSelection);
X509Certificate2 certificate = collection[0];
X509Certificate2UI.DisplayCertificate(certificate);
X509Chain chain = new X509Chain();
chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain;
chain.ChainPolicy.RevocationMode =
X509RevocationMode.Online; // X509RevocationMode.Offline;
chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 0, 30);
chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority;
chain.Build(certificate);
Console.WriteLine(output); for( int i=0;i< chain.ChainStatus.Length;i++)
{
Console.WriteLine(chain.ChainStatus[i].Status);
}