How can I get the certificate validity period with C # code?

How can I get certificate expiration using C # code?

I need to get certificate information in the Internet settings (-> content → certificates).

+4
source share
2 answers

Use the X509Store class to access certificates in the Windows certificate store. Then check the NotAfter property of the certificate of your choice, accessible through the X509Certificate2 class.

The help section for the X509Store class contains an example of how to list certificates and read their properties.

+6
source

Below is the bourne script shell to test it.

-1
source

Source: https://habr.com/ru/post/1315333/


All Articles