Sample code for 30+ languages & platforms
PowerShell

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

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/pem/my_cert.pem")
if ($success -eq $false) {
    $($cert.LastErrorText)
    exit
}

$pubkey = New-Object Chilkat.PublicKey
$cert.GetPublicKey($pubkey)

# Examine the public key as XML..
$($pubkey.GetXml())