-1

I didn't find the way how to get the private key expiration date from X509Certificate2. Is it possible with .NET or maybe I should use some third party libs to get this information?

Andrey
  • 65
  • 1
  • 8

1 Answers1

0

There is property NotAfter for this, check this link https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.notafter?view=net-5.0

kosist
  • 2,868
  • 2
  • 17
  • 30
  • This is correct one. Private keys often expire along with public key embedded in certificate. – Crypt32 Jan 21 '21 at 06:12
  • If I'm not mistaken, this property returns expiration date for public key, but in my case the private key has another date expiration than expiration date of public key – Andrey Jan 21 '21 at 06:47