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 Detached Digital Signature

Download Visual Basic Project Files and Source Code

This VB example program shows how to create a detached digital signature. An input file is loaded into a MIME message as an attachment, and then the MIME message is signed to create an x-pkcs7-signature message with a detached signature.

' Converts any kind of file into an S/MIME message with
' a detached (clear-text) 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 message with a detached signature.
        mime.AddDetachedSignature cert
        mime.SaveMime "signed.txt"
        
        ' In addition, any MIME message can converted and saved as XML:
        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-transfer-encoding: base64
'   content-type: application/x-pkcs7-signature;
'       name="smime.p7s"
'   content-disposition: attachment; filename="smime.p7s"


 

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

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