PowerShell
PowerShell
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
$cert = New-Object Chilkat.Cert
$strPem = "-----BEGIN CERTIFICATE----- ..."
$success = $cert.LoadPem($strPem)
if ($success -eq $false) {
$($cert.LastErrorText)
exit
}
$pubKey = New-Object Chilkat.PublicKey
$cert.GetPublicKey($pubKey)
# You can now use the public key object however it is needed,
# and access its various properties and methods..
$($pubKey.GetXml())