Sample code for 30+ languages & platforms
VB.NET

Load PFX/P12 from a Base64 Encoded PFX File

See more PFX/P12 Examples

Demonstrates how to call LoadPfxEncoded.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim bd As New Chilkat.BinData

success = bd.LoadFile("qa_data/pfx/cert_test123.pfx")
If (success <> True) Then
    Debug.WriteLine("Failed to load PFX file.")
    Exit Sub
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..."
Debug.WriteLine(strBase64)

Dim pfx As New Chilkat.Pfx

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


Debug.WriteLine("success")