Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Create S/MIME Signed-Data MessageThis Visual Basic sample program shows how to create an S/MIME signed-data message. A file is loaded into a MIME message as an attachment, a digital certificate is located and then used to create an x-pkcs7-mime signed-data message. ' Converts any kind of file into an S/MIME message with
' an attached (opaque) digital signature.
Private Sub Command1_Click()
Dim mime As New ChilkatMime
mime.UnlockComponent "Anything for 30-day trial"
mime.SetBodyFromPlainText "This is a message containing a GIF image file."
mime.AppendPartFromFile "dude.gif"
mime.SaveMime "unsigned.txt"
' Locate a certificate in the Current User Store (in the registry)
' There are many different ways of locating and using certificates
' using Cert, CertStore and CreateCS.
Dim ccs As New ChilkatCreateCS
Dim certStore As ChilkatCertStore
Dim cert As ChilkatCert
Set certStore = ccs.OpenCurrentUserStore()
Set cert = certStore.FindCertForEmail("matt@chilkatsoft.com")
' Use the certificate for signing.
' This creates a signed message.
mime.ConvertToSigned cert
mime.SaveMime "signed.txt"
' You can always convert MIME to XML
' XML is easier to parse, and you can always convert back from XML to MIME.
mime.SaveXml "signed.xml"
End Sub
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.