Classic ASP
Classic ASP
Load a PFX from an Encoded String
See more PFX/P12 Examples
Demonstrates Pfx.LoadPfxEncoded, which decodes text using a named binary encoding (such as base64) and loads the resulting bytes as a PFX / PKCS#12 container.
Background. This is useful when the PKCS#12 data has been transported or stored as printable text, such as base64.
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 PFX password should come from a secure source rather than being hard-coded.
password = "myPfxPassword"
' Decode the base64 text into PFX / PKCS#12 bytes and load them. Common encodings include base64
' and hex.
encodedPfx = "MIIKrAIBAzCCCm...base64-encoded-pfx..."
success = pfx.LoadPfxEncoded(encodedPfx,"base64",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>