Sample code for 30+ languages & platforms
Classic ASP

Load PFX/P12 from a Base64 Encoded PFX File

See more PFX/P12 Examples

Demonstrates how to call LoadPfxEncoded.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set bd = Server.CreateObject("Chilkat.BinData")

success = bd.LoadFile("qa_data/pfx/cert_test123.pfx")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Failed to load PFX file.") & "</pre>"
    Response.End
End If

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

' The base64 looks like this:  "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
Response.Write "<pre>" & Server.HTMLEncode( strBase64) & "</pre>"

set pfx = Server.CreateObject("Chilkat.Pfx")

' Load the PFX from the base64 string
password = "test123"
success = pfx.LoadPfxEncoded(strBase64,"base64",password)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( pfx.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "success") & "</pre>"

%>
</body>
</html>