Sample code for 30+ languages & platforms
Visual FoxPro

Get Public Key from Certificate PEM

See more Certificates Examples

Loads a certificate from a PEM file and gets the cert's public key.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loCert
LOCAL loPubkey

lnSuccess = 0

loCert = CreateObject('Chilkat.Cert')

lnSuccess = loCert.LoadFromFile("qa_data/certs/someCert.pem")
IF (lnSuccess = 0) THEN
    ? loCert.LastErrorText
    RELEASE loCert
    CANCEL
ENDIF

* Get the certificate's public key:
loPubkey = CreateObject('Chilkat.PublicKey')
loCert.GetPublicKey(loPubkey)

? loPubkey.GetPem(0)

* OK.. we have the public key which can be used in other Chilkat classes/methods...

RELEASE loCert
RELEASE loPubkey