VB.NET Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

VB.NET to Create S/MIME Detached Signature

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

This VB.NET example shows how to create an S/MIME Detached Signature.

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents CreateSig As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.CreateSig = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'CreateSig
        '
        Me.CreateSig.Location = New System.Drawing.Point(16, 24)
        Me.CreateSig.Name = "CreateSig"
        Me.CreateSig.Size = New System.Drawing.Size(104, 24)
        Me.CreateSig.TabIndex = 0
        Me.CreateSig.Text = "Create Signature"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CreateSig})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    ' Converts any kind of file into an S/MIME message with
    ' a detached (clear-text) signature.
    Private Sub CreateSig_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateSig.Click
        Dim mime As New Chilkat.Mime()


        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 Chilkat.CreateCS()
        Dim certStore As Chilkat.CertStore
        Dim cert As Chilkat.Cert

        certStore = ccs.OpenCurrentUserStore()
        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")

    End Sub
End Class





Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 
 

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

Mail Component · XML Parser