Classic ASP
Classic ASP
Load a PFX from BinData
See more PFX/P12 Examples
Demonstrates Pfx.LoadPfxBd, which loads a PFX / PKCS#12 container from the bytes held in a BinData object.
The file path is relative to the application's current working directory. An absolute path may also be used. Supply the path appropriate to your own environment.
Background. This is the in-memory equivalent of LoadPfxFile, for when the PKCS#12 data is already available as bytes rather than in a file.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set pfx = Server.CreateObject("Chilkat.Pfx")
' The file path is relative to the application's current working directory. An absolute path
' may also be used. Supply the path appropriate to your own environment.
' Load the PFX bytes into a BinData.
set bd = Server.CreateObject("Chilkat.BinData")
bLoaded = bd.LoadFile("qa_data/identity.pfx")
If (bLoaded <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( "Failed to load the PFX file.") & "</pre>"
Response.End
End If
' The PFX password should come from a secure source rather than being hard-coded.
password = "myPfxPassword"
' Load the PFX / PKCS#12 container from the bytes held in the BinData.
success = pfx.LoadPfxBd(bd,password)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( pfx.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Loaded " & pfx.NumCerts & " certificate(s).") & "</pre>"
%>
</body>
</html>