(PowerBuilder) Get Certificate Public Key from PEM
Demonstrates how to load a PEM file containing a certificate and access the 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/pem/my_cert.pem")
if li_Success <> 1 then
Write-Debug loo_Cert.LastErrorText
destroy loo_Cert
return
end if
loo_Pubkey = loo_Cert.ExportPublicKey()
if loo_Cert.LastMethodSuccess <> 1 then
Write-Debug loo_Cert.LastErrorText
destroy loo_Cert
return
end if
// Examine the public key as XML..
Write-Debug loo_Pubkey.GetXml()
destroy loo_Pubkey
destroy loo_Cert
|