Sample code for 30+ languages & platforms
B4X

Load PFX/P12 from a Base64 Encoded PFX File

See more PFX/P12 Examples

Demonstrates how to call LoadPfxEncoded.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

Dim bd As ChilkatBinData
bd.Initialize

success = bd.LoadFile("qa_data/pfx/cert_test123.pfx")
If success <> True Then
    Log("Failed to load PFX file.")
    Return
End If


'  Get the bytes contained in the PFX in base64 format:
Dim strBase64 As String = bd.GetEncoded("base64")

'  The base64 looks like this:  "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
Log(strBase64)

Dim pfx As ChilkatPfx
pfx.Initialize

'  Load the PFX from the base64 string
Dim password As String = "test123"
success = pfx.LoadPfxEncoded(strBase64, "base64", password)
If success <> True Then
    Log(pfx.LastErrorText)
    Return
End If


Log("success")