Sample code for 30+ languages & platforms
PowerBuilder

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

Chilkat PowerBuilder Downloads

PowerBuilder
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/pem/my_cert.pem")
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)

// Examine the public key as XML..
Write-Debug loo_Pubkey.GetXml()


destroy loo_Cert
destroy loo_Pubkey