Visual Basic Examples

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

VB Examples

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

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


VB Strings
VB Byte Array

 

 

 

 

 

 

 

Decrypt MIME with PFX

Download Chilkat MIME ActiveX

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"

Dim mime As New ChilkatMime

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

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

Dim certStore As New ChilkatCertStore
success = certStore.LoadPfxFile("myPfx.pfx","myPfxPassword")
If (success <> 1) Then
    Text1.Text = Text1.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 ChilkatCert
Set cert = certStore.FindCertBySubjectE("support@chilkatsoft.com")
If (cert Is Nothing ) Then
    Text1.Text = Text1.Text & certStore.LastErrorText & vbCrLf
    Exit Sub
End If

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

    Exit Sub
End If

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

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


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