Visual FoxPro
Visual FoxPro
Load a PFX from BinData
See more PFX/P12 Examples
Demonstrates Pfx.LoadPfxBd, which loads a PFX / PKCS#12 container from the bytes held in a BinData object.
The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path appropriate to your own environment.
Background. This is the in-memory equivalent of LoadPfxFile, for when the PKCS#12 data is already available as bytes rather than in a file.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loPfx
LOCAL loBd
LOCAL lnBLoaded
LOCAL lcPassword
lnSuccess = 0
loPfx = CreateObject('Chilkat.Pfx')
* The file path is relative to the application's current working directory. An absolute path
* may also be used. Supply the path appropriate to your own environment.
* Load the PFX bytes into a BinData.
loBd = CreateObject('Chilkat.BinData')
lnBLoaded = loBd.LoadFile("qa_data/identity.pfx")
IF (lnBLoaded <> 1) THEN
? "Failed to load the PFX file."
RELEASE loPfx
RELEASE loBd
CANCEL
ENDIF
* The PFX password should come from a secure source rather than being hard-coded.
lcPassword = "myPfxPassword"
* Load the PFX / PKCS#12 container from the bytes held in the BinData.
lnSuccess = loPfx.LoadPfxBd(loBd,lcPassword)
IF (lnSuccess = 0) THEN
? loPfx.LastErrorText
RELEASE loPfx
RELEASE loBd
CANCEL
ENDIF
? "Loaded " + STR(loPfx.NumCerts) + " certificate(s)."
RELEASE loPfx
RELEASE loBd