(PowerBuilder) Get Public Key from Certificate PEM
Loads a certificate from a PEM file and gets the cert's public key.
integer li_rc
oleobject loo_Cert
integer li_Success
oleobject loo_Pubkey
loo_Cert = create oleobject
// Use "Chilkat_9_5_0.Cert" for versions of Chilkat < 10.0.0
li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert")
if li_rc < 0 then
destroy loo_Cert
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = loo_Cert.LoadFromFile("qa_data/certs/someCert.pem")
if li_Success <> 1 then
Write-Debug loo_Cert.LastErrorText
destroy loo_Cert
return
end if
// Get the certificate's public key:
loo_Pubkey = loo_Cert.ExportPublicKey()
if loo_Cert.LastMethodSuccess <> 1 then
Write-Debug loo_Cert.LastErrorText
destroy loo_Cert
return
end if
Write-Debug loo_Pubkey.GetPem(0)
// OK.. we have the public key which can be used in other Chilkat classes/methods...
destroy loo_Pubkey
destroy loo_Cert
|