(PowerBuilder) RSA Import Public Key
Shows how to select/import a public key for RSA encryption or signature verification.
integer li_rc
oleobject loo_PubKey
integer li_Success
oleobject loo_Rsa
loo_PubKey = create oleobject
// Use "Chilkat_9_5_0.PublicKey" for versions of Chilkat < 10.0.0
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
// Use "Chilkat_9_5_0.Rsa" for versions of Chilkat < 10.0.0
li_rc = loo_Rsa.ConnectToNewObject("Chilkat.Rsa")
// Tell RSA to use the public key.
loo_Rsa.ImportPublicKeyObj(loo_PubKey)
destroy loo_PubKey
destroy loo_Rsa
|