Classic ASP Requires Chilkat v11.0.0+
Classic ASP
Sign an EML using RSA-PSS and SHA-256
See more Email Object Examples
Load the intended signing certificate and its RSA private key from a PFX. Set the signature options on Email and render the final S/MIME message through MailMan. The resulting multipart/signed file can be verified independently. Supply the PFX password through your application’s credential store.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
set email = Server.CreateObject("Chilkat.Email")
success = email.LoadEml("message.eml")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
Response.End
End If
set cert = Server.CreateObject("Chilkat.Cert")
success = cert.LoadPfxFile("signer.pfx","PFX_PASSWORD")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( cert.LastErrorText) & "</pre>"
Response.End
End If
success = email.SetSigningCert(cert)
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( email.LastErrorText) & "</pre>"
Response.End
End If
email.SigningAlg = "pss"
email.SigningHashAlg = "sha256"
email.SendSigned = 1
set mail = Server.CreateObject("Chilkat.MailMan")
mail.OpaqueSigning = 0
set rendered = Server.CreateObject("Chilkat.BinData")
success = mail.RenderToMimeBd(email,rendered)
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( mail.LastErrorText) & "</pre>"
Response.End
End If
success = rendered.WriteFile("signed.eml")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( "Failed: rendered.WriteFile.") & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Saved signed.eml.") & "</pre>"
%>
</body>
</html>