Get certificate information - AIA, CDP, Cert Template Information

Mar 30 at 6:18 PM
Edited Mar 30 at 6:20 PM
Hi PSPKI Gurus,

Is it possible to query and extract via PSPKI (or other powershell-based) methods the following information from a certificate file.
I am not looking for certutil solution.
Currently using PSPKI 3.0
  • URL values for Authority Information Access (OID: 1.3.6.1.5.5.7.1.1)
    I am looking to get the "URL=........." Information
  • URL values for the CRL Distribution Points (OID: 2.5.29.31)
    I am looking to get the "URL=........." Information
  • Certificate Template Information (OID: 1.3.6.1.4.1.311.21.7)
    I am looking to get the "Template=............." information
I can't seem to be able to get that information even if I use System.Security.Cryptography.X509Certificates.X509Certificate2.

Probably I am missing something obvious and I will appreciate the guidance.
Coordinator
Apr 16 at 10:49 AM
By using PSPKI module you can do this:
$cert = new-object security.cryptography.x509certificates.x509certificate2 <arguments>
$extensions = [PKI.Utils.CLRExtensions]::ResolveExtensions($cert)
# retrieve URLs from CDP extension:
$extensions["2.5.29.31"].GetURLs()
# retrieve issuer URLs from AIA extension:
$extensions["1.3.6.1.5.5.7.1.1"].CertificationAuthorityIssuer
# retrieveve OCSP URLs from AIA extension:
$extensions["1.3.6.1.5.5.7.1.1"].OnlineCertificateStatusProtocol
# retrieve certificate template information:
$extensions["1.3.6.1.4.1.311.21.7"]

HTH