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
S/MIME EncryptionThis Visual Basic sample program shows how to S/MIME encrypt a file. It loads a file into a MIME message as an attachment, locates a digital certificate, and then encrypts the MIME message to an x-pkcs7-mime encrypted message. ' Encrypts any kind of file into an S/MIME encrypted message.
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 "unencrypted.txt"
' NOTE: Any MIME object can be converted to XML
mime.SaveXml "unencrypted.xml"
' 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 encryption.
' This creates an encrypted S/MIME message.
mime.Encrypt cert
mime.SaveMime "encrypted.txt"
End Sub
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.