Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCert
LOCAL cStrPem
LOCAL oPubKey

nSuccess := 0

oCert := CreateObject("Chilkat.Cert")

cStrPem := "-----BEGIN CERTIFICATE----- ..."

nSuccess := oCert:LoadPem(cStrPem)
IF (nSuccess == 0)
    ? oCert:LastErrorText
    oCert:destroy()
    RETURN
ENDIF

oPubKey := CreateObject("Chilkat.PublicKey")
oCert:GetPublicKey(oPubKey)

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

? oPubKey:GetXml()

oCert:destroy()
oPubKey:destroy()