Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Decrypt MIME with PFXDemonstrates 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" LOCAL loMime LOCAL lnSuccess LOCAL loCertStore LOCAL loCert LOCAL loPrivKey loMime = CreateObject('Chilkat.Mime') lnSuccess = loMime.UnlockComponent("Anything for 30-day trial") IF (lnSuccess = 0) THEN =MESSAGEBOX("Failed to unlock component") QUIT ENDIF lnSuccess = loMime.LoadMimeFile("encryptedEmail.eml") IF (lnSuccess <> 1) THEN ? loMime.LastErrorText QUIT ENDIF loCertStore = CreateObject('Chilkat.CertStore') lnSuccess = loCertStore.LoadPfxFile("myPfx.pfx","myPfxPassword") IF (lnSuccess <> 1) THEN ? loCertStore.LastErrorText QUIT ENDIF * Find the certificate by email address. There are many * ways to find certificates within a Chilkat certificate store * object... loCert = loCertStore.FindCertBySubjectE("support@chilkatsoft.com") IF (loCert = NULL ) THEN ? loCertStore.LastErrorText QUIT ENDIF loPrivKey = loCert.ExportPrivateKey() IF (loPrivKey = NULL ) THEN ? loCert.LastErrorText RELEASE loCert QUIT ENDIF lnSuccess = loMime.Decrypt2(loCert,loPrivKey) IF (lnSuccess <> 1) THEN ? loMime.LastErrorText QUIT ENDIF * Show the decrypted MIME: ? loMime.GetMime() RELEASE loCert RELEASE loPrivKey |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser