Sample code for 30+ languages & platforms
PowerShell

RSA Import Public Key

See more RSA Examples

Shows how to select/import a public key for RSA encryption or signature verification.

Chilkat PowerShell Downloads

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

$success = $false

$pubKey = New-Object Chilkat.PublicKey
# In all Chilkat methods expecting a path, you pass either absolute or relative paths.
$success = $pubKey.LoadFromFile("rsaKeys/myTestRsaPublic.pem")
if ($success -eq $false) {
    $($pubKey.LastErrorText)
    exit
}

$rsa = New-Object Chilkat.Rsa

# Tell RSA to use the public key.
$rsa.UsePublicKey($pubKey)