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

 

 

 

 

 

 

 

Create S/MIME Signed-Data Message

Download Visual Basic Project Files and Source Code

This 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

        ' 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 "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

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


 

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

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