(PowerBuilder) RSA Import Public Key
Shows how to select/import a public key for RSA encryption or signature verification.Note: This example requires Chilkat v11.0.0 or greater.
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
|