Sample code for 30+ languages & platforms
PowerShell

Get Public Key from Certificate PEM

See more Certificates Examples

Loads a certificate from a PEM file and gets the cert's 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/certs/someCert.pem")
if ($success -eq $false) {
    $($cert.LastErrorText)
    exit
}

# Get the certificate's public key:
$pubkey = New-Object Chilkat.PublicKey
$cert.GetPublicKey($pubkey)

$($pubkey.GetPem($false))

# OK.. we have the public key which can be used in other Chilkat classes/methods...