(DataFlex) Convert Certificate from DER to PEM.
Loads a digital certificate from any format, such as DER, and saves to PEM format.
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoCert
Boolean iSuccess
String sTemp1
Get Create (RefClass(cComChilkatCert)) To hoCert
If (Not(IsComObjectCreated(hoCert))) Begin
Send CreateComObject of hoCert
End
// 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.
Get ComLoadFromFile Of hoCert "qa_data/certs/testCert.cer" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoCert To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComExportCertPemFile Of hoCert "qa_data/certs/testCert.pem" To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoCert To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Converted certificate from DER to PEM format."
End_Procedure
|