(Visual FoxPro) Load PFX/P12 from a Base64 Encoded PFX File
Demonstrates how to call LoadPfxEncoded.
LOCAL loBd
LOCAL lnSuccess
LOCAL lcStrBase64
LOCAL loPfx
LOCAL lcPassword
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBd = CreateObject('Chilkat.BinData')
lnSuccess = loBd.LoadFile("qa_data/pfx/cert_test123.pfx")
IF (lnSuccess <> 1) THEN
? "Failed to load PFX file."
RELEASE loBd
CANCEL
ENDIF
* Get the bytes contained in the PFX in base64 format:
lcStrBase64 = loBd.GetEncoded("base64")
* The base64 looks like this: "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
? lcStrBase64
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Pfx')
loPfx = CreateObject('Chilkat.Pfx')
* Load the PFX from the base64 string
lcPassword = "test123"
lnSuccess = loPfx.LoadPfxEncoded(lcStrBase64,"base64",lcPassword)
IF (lnSuccess <> 1) THEN
? loPfx.LastErrorText
RELEASE loBd
RELEASE loPfx
CANCEL
ENDIF
? "success"
RELEASE loBd
RELEASE loPfx
|