FoxPro Examples

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

Visual FoxPro Examples

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

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

 

Non-Chilkat Links
Text and String Handling

Decrypt P7M using PFX to get MIME

Demonstrates how to decrypt a .p7m (PKCS7) binary file using a certificate and private key from a PFX file. The result of the decryption (in this case) is MIME text that may be loaded into a Chilkat MIME object.

Note: Any type of file or data may be encrypted to produce a .p7m (PKCS7) encrypted file. This example was prompted by a customer needing to decrypt a MIME message. The final step of loading the decrypted text into a MIME object would be skipped if decrypting something other than MIME..

Download Chilkat Crypt ActiveX

Download Chilkat MIME ActiveX

LOCAL loCrypt
LOCAL lnSuccess
LOCAL loP7mData
LOCAL lcPfxFilePath
LOCAL lcPfxPassword
LOCAL lcMimeText
LOCAL loMime


loCrypt = CreateObject('Chilkat.Crypt2')

*  Any string argument automatically begins the 30-day trial.

lnSuccess = loCrypt.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loCrypt.LastErrorText)
    QUIT
ENDIF

*  Read the P7M file into memory.

loP7mData = loCrypt.ReadFile("encrypted.p7m")

*  Setup the crypt object:

*  Indicate that public-key decryption is to be used.
loCrypt.CryptAlgorithm = "pki"

*  Add a PFX file to allow the crypt object to find
*  the certificate and private key needed for decryption

lcPfxFilePath = "myPfx.pfx"

lcPfxPassword = "secret"
lnSuccess = loCrypt.AddPfxSourceFile(lcPfxFilePath,lcPfxPassword)
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loCrypt.LastErrorText)
    QUIT
ENDIF

*  Assuming the decrypted data will be text, decrypt to
*  a string.

lcMimeText = loCrypt.DecryptString(loP7mData)
IF (lcMimeText = NULL ) THEN
    =MESSAGEBOX(loCrypt.LastErrorText)
    QUIT
ENDIF

*  Note: Chilkat Crypt and Chilkat MIME are separate products.
*  To use both objects, one would license the "Chilkat Bundle",
*  which provides licenses to all existing Chilkat products.
*  This is less expensive than licensing each of the two products separately.

loMime = CreateObject('Chilkat.Mime')

lnSuccess = loMime.UnlockComponent("Anyting for 30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Load the MIME text into the MIME object.
lnSuccess = loMime.LoadMime(lcMimeText)
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Save the MIME to a file:
lnSuccess = loMime.SaveMime("outMime.txt")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Success!  Output the MIME text:
? loMime.GetMime()


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

Mail Component · .NET Email Component · ASP Mail Component · XML Parser