(PowerBuilder) Get Public Key from Certificate PEM
Loads a certificate from a PEM file and gets the cert's public key. Note: This example requires Chilkat v11.0.0 or greater.
integer li_rc
integer li_Success
oleobject loo_Cert
oleobject loo_Pubkey
li_Success = 0
loo_Cert = create oleobject
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 = 0 then
Write-Debug loo_Cert.LastErrorText
destroy loo_Cert
return
end if
// Get the certificate's public key:
loo_Pubkey = create oleobject
li_rc = loo_Pubkey.ConnectToNewObject("Chilkat.PublicKey")
loo_Cert.GetPublicKey(loo_Pubkey)
Write-Debug loo_Pubkey.GetPem(0)
// OK.. we have the public key which can be used in other Chilkat classes/methods...
destroy loo_Cert
destroy loo_Pubkey
|