ebekker / ACMESharp

An ACME client library and PowerShell client for the .NET platform (Let's Encrypt)
https://pkisharp.github.io/ACMESharp-docs/
1.21k stars 185 forks source link

Add validity start/end to get-acmecertificate #351

Closed boojew closed 5 years ago

boojew commented 6 years ago

We're using ACMESharp to generate PEM files and it would be fantastic if get-acmecertificate returned the dates the certificate is valid for.

ebekker commented 5 years ago

I recommend leveraging the strengths of PWSH:

$pemPath = "$PWD\path\to\your\file.pem"
$pemBytes = [System.IO.File]::ReadAllBytes($pemPath)
$pemCert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($pemBytes)

## Get the start/end dates (or any other Cert property you care for)
$pemCert.NotBefore
$pemCert.NotAfter
$pemCert.Issuer
$pemCert.Subject
boojew commented 5 years ago

In fact, I've found it's even easier - the get-pfxcertificate cmdlet can be used w/ just about all formats of certs; however, my request was more about getting the validity of certs that acmesharp has requested (and I imagine are somehow linked to the vault?) so that I can see the overall status of my LE certs. Obviously, I have a workaround, but I thought this could be handy

ebekker commented 5 years ago

I don't think I understand what you mean -- a cert's validity is part of the cert itself. There really isn't anything external to that that's stored in the vault or returned from LE. Perhaps you're thinking of the expiration on the Identifier validation, or the issued Challenges? If that's the case, there are some details for that which are stored as part of the corresponding entities (Identifier / Challenge) but those would not be from Get-ACMECertificate cmdlet.