Sample code for 30+ languages & platforms
PowerShell

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat PowerShell Downloads

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

$success = $false

$cert = New-Object Chilkat.Cert

# ------------------------------------------------------------------------
# The ExportPublicKey method is deprecated:

$publickeyObj = $cert.ExportPublicKey()
if ($cert.LastMethodSuccess -eq $false) {
    $($cert.LastErrorText)
    exit
}

# ...
# ...

# ------------------------------------------------------------------------
# Do the equivalent using GetPublicKey.
# Your application creates a new, empty PublicKey object which is passed 
# in the last argument and filled upon success.

$publickeyOut = New-Object Chilkat.PublicKey
$success = $cert.GetPublicKey($publickeyOut)
if ($success -eq $false) {
    $($cert.LastErrorText)
    exit
}