How to

get begin and expiration date from X.509 certificate

Published: 28. December 2014 | Updated: 28. December 2014
License: Microsoft Public License (MS-PL)
Categories: Security
Tags: C# Security
Was this snippet helpful for you? YESYES / NONO
Get Analyzant!

Check your entire website from code to content in minutes with Analyzant, the free analysis suite.

Free download at analyzant.com

Import namespaces

using System;
using System.Security.Cryptography.X509Certificates;

Code

// load certificate
var x509 = new X509Certificate2(X509Certificate.CreateFromSignedFile(@"C:\mySignedFile.exe"));

Console.WriteLine("Begin date: {0}", x509.NotBefore);
Console.WriteLine("Expiration date: {0}", x509.NotAfter);
Send us feedback about this snippet »



Related Snippets: