![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(ASP) S/MIME Signed MessageCreate an S/MIME signed (PKCS7) message. Important: This example is specific to the Windows operating system because it obtains the certificate and private key from the Windows registry-based certificate store. For other operating systems, see the PKCS7 signature examples that use PFX (.p12) files.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% set mime = Server.CreateObject("Chilkat.Mime") success = mime.UnlockComponent("Anything for 30-day trial.") If (success = 0) Then Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>" End If mime.AddHeaderField "Subject","This is a test" mime.AddHeaderField "Abc","123" mime.SetBodyFromPlainText "This is the body" set cert = Server.CreateObject("Chilkat.Cert") ' Load a certificate that has already been installed (from a .pfx) ' on the computer: success = cert.LoadByEmailAddress("thawte@chilkatsoft.com") If (success = 0) Then Response.Write "<pre>" & Server.HTMLEncode(cert.LastErrorText) & "</pre>" End If ' Convert to a signed message. success = mime.ConvertToSigned(cert) If (success = 0) Then Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>" End If ' Display the signed MIME: Response.Write "<pre>" & Server.HTMLEncode( mime.GetMime()) & "</pre>" Response.Write "<pre>" & Server.HTMLEncode( "----") & "</pre>" ' Unwrap to restore the original MIME. success = mime.UnwrapSecurity() If (success = 0) Then Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>" End If ' Display the restored (unsigned) MIME: Response.Write "<pre>" & Server.HTMLEncode( mime.GetMime()) & "</pre>" %> </body> </html> |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.