Sample code for 30+ languages & platforms
PowerShell

Get Certificate Policy

See more Certificates Examples

Demonstrates how to get a certificate's policy OIDs (if any)

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$cert = New-Object Chilkat.Cert

$success = $cert.LoadFromFile("qa_data/certs/sample.cer")
if ($success -eq $false) {
    $($cert.LastErrorText)
    exit
}

# The certificatePolicies OID is 2.5.29.32
$oid = "2.5.29.32"
$strXml = $cert.GetExtensionAsXml($oid)
if ($cert.LastMethodSuccess -eq $true) {
    $($strXml)

    # Sample result:
    # <sequence><sequence><oid>2.16.840.1.101.2.1.11.39</oid></sequence></sequence>

    $xml = New-Object Chilkat.Xml
    $xml.LoadXml($strXml)
    $("Policy OID = " + $xml.GetChildContent("sequence|oid"))
}