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

 

 

 

 

 

 

Decrypt MIME with PFX

Demonstrates how to decrypt MIME using a PFX (containing a digital certificate with private key). The content-type of an encrypted MIME message looks like this:

Content-Type: application/x-pkcs7-mime;
	name="smime.p7m"

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

Dim mime As New Chilkat.Mime()

Dim success As Boolean
success = mime.UnlockComponent("Anything for 30-day trial")
If (success = false) Then
    MsgBox("Failed to unlock component")
    Exit Sub
End If


success = mime.LoadMimeFile("encryptedEmail.eml")
If (success <> true) Then
    TextBox1.Text = TextBox1.Text & mime.LastErrorText & vbCrLf
    Exit Sub
End If


Dim certStore As New Chilkat.CertStore()
success = certStore.LoadPfxFile("myPfx.pfx","myPfxPassword")
If (success <> true) Then
    TextBox1.Text = TextBox1.Text & certStore.LastErrorText & vbCrLf
    Exit Sub
End If


'  Find the certificate by email address.  There are many
'  ways to find certificates within a Chilkat certificate store
'  object...
Dim cert As Chilkat.Cert
cert = certStore.FindCertBySubjectE("support@chilkatsoft.com")
If (cert Is Nothing ) Then
    TextBox1.Text = TextBox1.Text & certStore.LastErrorText & vbCrLf
    Exit Sub
End If


Dim privKey As Chilkat.PrivateKey
privKey = cert.ExportPrivateKey()
If (privKey Is Nothing ) Then
    TextBox1.Text = TextBox1.Text & cert.LastErrorText & vbCrLf

    Exit Sub
End If


success = mime.Decrypt2(cert,privKey)
If (success <> true) Then
    TextBox1.Text = TextBox1.Text & mime.LastErrorText & vbCrLf
    Exit Sub
End If


'  Show the decrypted MIME:
TextBox1.Text = TextBox1.Text & mime.GetMime() & vbCrLf






 

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

Mail Component · XML Parser