VBScript Examples

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

VBScript Examples

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

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

 

 

 

 

 

 

 

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 fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

set mime = CreateObject("Chilkat.Mime")

success = mime.UnlockComponent("Anything for 30-day trial")
If (success = 0) Then
    MsgBox "Failed to unlock component"
    WScript.Quit
End If

success = mime.LoadMimeFile("encryptedEmail.eml")
If (success <> 1) Then
    outFile.WriteLine(mime.LastErrorText)
    WScript.Quit
End If

set certStore = CreateObject("Chilkat.CertStore")
success = certStore.LoadPfxFile("myPfx.pfx","myPfxPassword")
If (success <> 1) Then
    outFile.WriteLine(certStore.LastErrorText)
    WScript.Quit
End If

'  Find the certificate by email address.  There are many
'  ways to find certificates within a Chilkat certificate store
'  object...

' cert is a Chilkat.Cert
Set cert = certStore.FindCertBySubjectE("support@chilkatsoft.com")
If (cert Is Nothing ) Then
    outFile.WriteLine(certStore.LastErrorText)
    WScript.Quit
End If

' privKey is a Chilkat.PrivateKey
Set privKey = cert.ExportPrivateKey()
If (privKey Is Nothing ) Then
    outFile.WriteLine(cert.LastErrorText)

    WScript.Quit
End If

success = mime.Decrypt2(cert,privKey)
If (success <> 1) Then
    outFile.WriteLine(mime.LastErrorText)
    WScript.Quit
End If

'  Show the decrypted MIME:
outFile.WriteLine(mime.GetMime())


outFile.Close

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

Mail Component · XML Parser