Sample code for 30+ languages & platforms
Classic ASP

Example: Crypt2.SetDecryptCert method

Demonstrates how to call the SetDecryptCert method.

Chilkat Classic ASP Downloads

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

set cert = Server.CreateObject("Chilkat.Cert")

success = cert.LoadPfxFile("c:/pfx_files/my.pfx","password")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
    Response.End
End If

set decrypt = Server.CreateObject("Chilkat.Crypt2")
decrypt.CryptAlgorithm = "pki"

success = decrypt.SetDecryptCert(cert)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( decrypt.LastErrorText) & "</pre>"
    Response.End
End If

set bd = Server.CreateObject("Chilkat.BinData")
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat")

success = decrypt.DecryptBd(bd)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( decrypt.LastErrorText) & "</pre>"
    Response.End
End If

' bd contains the decrypted content.

%>
</body>
</html>