DataFlex
DataFlex
Load PFX/P12 from a Base64 Encoded PFX File
See more PFX/P12 Examples
Demonstrates how to call LoadPfxEncoded.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoBd
String sStrBase64
Handle hoPfx
String sPassword
String sTemp1
Move False To iSuccess
Get Create (RefClass(cComChilkatBinData)) To hoBd
If (Not(IsComObjectCreated(hoBd))) Begin
Send CreateComObject of hoBd
End
Get ComLoadFile Of hoBd "qa_data/pfx/cert_test123.pfx" To iSuccess
If (iSuccess <> True) Begin
Showln "Failed to load PFX file."
Procedure_Return
End
// Get the bytes contained in the PFX in base64 format:
Get ComGetEncoded Of hoBd "base64" To sStrBase64
// The base64 looks like this: "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
Showln sStrBase64
Get Create (RefClass(cComChilkatPfx)) To hoPfx
If (Not(IsComObjectCreated(hoPfx))) Begin
Send CreateComObject of hoPfx
End
// Load the PFX from the base64 string
Move "test123" To sPassword
Get ComLoadPfxEncoded Of hoPfx sStrBase64 "base64" sPassword To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoPfx To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "success"
End_Procedure