Sample code for 30+ languages & platforms
Lianja

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 Lianja Downloads

Lianja
llSuccess = .F.

loCert = createobject("CkCert")

llSuccess = loCert.LoadFromFile("qa_data/certs/someCert.pem")
if (llSuccess = .F.) then
    ? loCert.LastErrorText
    release loCert
    return
endif

// Get the certificate's public key:
loPubkey = createobject("CkPublicKey")
loCert.GetPublicKey(loPubkey)

? loPubkey.GetPem(.F.)

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


release loCert
release loPubkey