Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out if X509Certificate2 is revoked?

Tags:

c#

asp.net

How can I figure out if an X509Certificate2 has been revoked? I assume the Verify() method checks it, but it doesn't explicitly state it in the help. Does anybody know?

Also: does the Verify() check if the certificate is expired?

like image 649
Krumelur Avatar asked Feb 28 '11 21:02

Krumelur


1 Answers

Have you tried using the X509Chain?

var chain = new X509Chain();
chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain;
chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(1000);
chain.ChainPolicy.VerificationTime = DateTime.Now;
var elementValid = chain.Build (x509certificate);
like image 124
m0sa Avatar answered Oct 23 '22 06:10

m0sa