Sample code for 30+ languages & platforms
Xbase++

Convert Certificate from DER to PEM.

See more Certificates Examples

Loads a digital certificate from any format, such as DER, and saves to PEM format.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCert

nSuccess := 0

oCert := CreateObject("Chilkat.Cert")

//  LoadFromFile will load virtually any certificate format file.
//  It will auto-recognize the format and load appropiately.
//  In this case, load a DER format certificate and convert to PEM.
nSuccess := oCert:LoadFromFile("qa_data/certs/testCert.cer")
IF (nSuccess != 1)
    ? oCert:LastErrorText
    oCert:destroy()
    RETURN
ENDIF

nSuccess := oCert:ExportCertPemFile("qa_data/certs/testCert.pem")
IF (nSuccess != 1)
    ? oCert:LastErrorText
    oCert:destroy()
    RETURN
ENDIF

? "Converted certificate from DER to PEM format."

oCert:destroy()