Sample code for 30+ languages & platforms
PowerBuilder

RSA Import Public Key

See more RSA Examples

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

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_PubKey
oleobject loo_Rsa

li_Success = 0

loo_PubKey = create oleobject
li_rc = loo_PubKey.ConnectToNewObject("Chilkat.PublicKey")
if li_rc < 0 then
    destroy loo_PubKey
    MessageBox("Error","Connecting to COM object failed")
    return
end if
// In all Chilkat methods expecting a path, you pass either absolute or relative paths.
li_Success = loo_PubKey.LoadFromFile("rsaKeys/myTestRsaPublic.pem")
if li_Success = 0 then
    Write-Debug loo_PubKey.LastErrorText
    destroy loo_PubKey
    return
end if

loo_Rsa = create oleobject
li_rc = loo_Rsa.ConnectToNewObject("Chilkat.Rsa")

// Tell RSA to use the public key.
loo_Rsa.UsePublicKey(loo_PubKey)


destroy loo_PubKey
destroy loo_Rsa