Sample code for 30+ languages & platforms
Xbase++

Load PFX/P12 from a Base64 Encoded PFX File

See more PFX/P12 Examples

Demonstrates how to call LoadPfxEncoded.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oBd
LOCAL cStrBase64
LOCAL oPfx
LOCAL cPassword

nSuccess := 0

oBd := CreateObject("Chilkat.BinData")

nSuccess := oBd:LoadFile("qa_data/pfx/cert_test123.pfx")
IF (nSuccess != 1)
    ? "Failed to load PFX file."
    oBd:destroy()
    RETURN
ENDIF

//  Get the bytes contained in the PFX in base64 format:
cStrBase64 := oBd:GetEncoded("base64")

//  The base64 looks like this:  "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
? cStrBase64

oPfx := CreateObject("Chilkat.Pfx")

//  Load the PFX from the base64 string
cPassword := "test123"
nSuccess := oPfx:LoadPfxEncoded(cStrBase64, "base64", cPassword)
IF (nSuccess != 1)
    ? oPfx:LastErrorText
    oBd:destroy()
    oPfx:destroy()
    RETURN
ENDIF

? "success"

oBd:destroy()
oPfx:destroy()