Sample code for 30+ languages & platforms
PowerBuilder

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

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Cert

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

// 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.
li_Success = loo_Cert.LoadFromFile("qa_data/certs/testCert.cer")
if li_Success <> 1 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Cert
    return
end if

li_Success = loo_Cert.ExportCertPemFile("qa_data/certs/testCert.pem")
if li_Success <> 1 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Cert
    return
end if

Write-Debug "Converted certificate from DER to PEM format."


destroy loo_Cert