C# Examples

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

C# Examples

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


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

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

Chilkat.Mime mime = new Chilkat.Mime();

bool success;
success = mime.UnlockComponent("Anything for 30-day trial");
if (success == false) {
    MessageBox.Show("Failed to unlock component");
    return;
}

success = mime.LoadMimeFile("encryptedEmail.eml");
if (success != true) {
    textBox1.Text += mime.LastErrorText + "\r\n";
    return;
}

Chilkat.CertStore certStore = new Chilkat.CertStore();
success = certStore.LoadPfxFile("myPfx.pfx","myPfxPassword");
if (success != true) {
    textBox1.Text += certStore.LastErrorText + "\r\n";
    return;
}

//  Find the certificate by email address.  There are many
//  ways to find certificates within a Chilkat certificate store
//  object...
Chilkat.Cert cert = null;
cert = certStore.FindCertBySubjectE("support@chilkatsoft.com");
if (cert == null ) {
    textBox1.Text += certStore.LastErrorText + "\r\n";
    return;
}

Chilkat.PrivateKey privKey = null;
privKey = cert.ExportPrivateKey();
if (privKey == null ) {
    textBox1.Text += cert.LastErrorText + "\r\n";

    return;
}

success = mime.Decrypt2(cert,privKey);
if (success != true) {
    textBox1.Text += mime.LastErrorText + "\r\n";
    return;
}

//  Show the decrypted MIME:
textBox1.Text += mime.GetMime() + "\r\n";


 

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

Email Component · XML Parser