Sample code for 30+ languages & platforms
Visual Basic 6.0

Load PFX/P12 from a Base64 Encoded PFX File

See more PFX/P12 Examples

Demonstrates how to call LoadPfxEncoded.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim bd As New ChilkatBinData

success = bd.LoadFile("qa_data/pfx/cert_test123.pfx")
If (success <> 1) Then
    Debug.Print "Failed to load PFX file."
    Exit Sub
End If

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

' The base64 looks like this:  "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
Debug.Print strBase64

Dim pfx As New ChilkatPfx

' Load the PFX from the base64 string
Dim password As String
password = "test123"
success = pfx.LoadPfxEncoded(strBase64,"base64",password)
If (success <> 1) Then
    Debug.Print pfx.LastErrorText
    Exit Sub
End If

Debug.Print "success"