Sample code for 30+ languages & platforms
PowerBuilder

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Cert
string ls_StrPem
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

ls_StrPem = "-----BEGIN CERTIFICATE----- ..."

li_Success = loo_Cert.LoadPem(ls_StrPem)
if li_Success = 0 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Cert
    return
end if

loo_PubKey = create oleobject
li_rc = loo_PubKey.ConnectToNewObject("Chilkat.PublicKey")

loo_Cert.GetPublicKey(loo_PubKey)

// You can now use the public key object however it is needed,
// and access its various properties and methods..

Write-Debug loo_PubKey.GetXml()


destroy loo_Cert
destroy loo_PubKey