Visual Basic Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



VB Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Unicode
Upload
XML
XMP
Zip Compression

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor


VB Strings
VB Byte Array

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

S/MIME Encryption

Download Visual Basic Project Files and Source Code

This 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

        ' Get a 30-day trial code from http:'www.chilkatsoft.com/register30.asp
        mime.UnlockComponent "UnlockCode"
        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

' Relevant keywords: mime type, mime format, mime tool, mime decoder, mime file, mime decode
' mime file, mime protocol, mime rfc, mime header, email mime, mail mime, mime decoding,
' mime attachment, mime reader, mime download, mime converter, mime content type,
' mime message, mime file type, mime html, mime downloads, mime parser, mime pdf, convert mime
' mime encoding, mime version 1.0, mime pic, mime video, mime software, mime viewer,
'
'   content-disposition: attachment; filename="smime.p7m"
'   content-transfer-encoding: base64
'   content-type: application/x-pkcs7-mime;
'       name="smime.p7m"



 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.