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

Unwrap S/MIME Security Layers

Download Chilkat MIME ActiveX

Demonstrates how to unwrap the security layers of a signed and/or encrypted S/MIME message.

LOCAL i
LOCAL loMime
LOCAL lnSuccess
LOCAL loCert
LOCAL lnNumSignerCerts
LOCAL lnNumEncryptCerts



loMime = CreateObject('Chilkat.Mime')

lnSuccess = loMime.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess = 0) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Note: Your S/MIME file may have a different file extension.
lnSuccess = loMime.LoadMimeFile("smime.eml")
IF (lnSuccess = 0) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Unwrap any security layers so that the resultant MIME
*  is the original message before signing and/or encrypting
*  was applied.  UnwrapSecurity returns 1 if
*  there was nothing to unwrap, or if all signatures were verified,
*  and all decryptions succeeded.
lnSuccess = loMime.UnwrapSecurity()
IF (lnSuccess = 0) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Save the unwrapped S/MIME:
lnSuccess = loMime.SaveMime("unwrapped.eml")
IF (lnSuccess = 0) THEN
    =MESSAGEBOX(loMime.LastErrorText)
    QUIT
ENDIF

*  Let's see if the MIME was signed, and if so whether
*  the signature(s) were verified.  Also, examine the certificate
*  used for signing.

*  Unwrapping the security sets the NumSignerCerts property.
*  If it is non-zero, then signatures were unwrapped...
? "Signer Certificates: "

lnNumSignerCerts = loMime.NumSignerCerts
IF (lnNumSignerCerts > 0) THEN
    FOR i = 0 TO lnNumSignerCerts - 1
        loCert = loMime.GetSignerCert(i)
        IF (NOT (loCert = NULL )) THEN
            *  Show the cert's common name.
            ? loCert.SubjectCN
        ENDIF

    NEXT
ENDIF

*  Now check to see if anything was decrypted.
? "Encryption Certificates: "

lnNumEncryptCerts = loMime.NumEncryptCerts
IF (lnNumEncryptCerts > 0) THEN
    FOR i = 0 TO lnNumEncryptCerts - 1
        loCert = loMime.GetEncryptCert(i)
        IF (NOT (loCert = NULL )) THEN
            *  Show the cert's common name.
            ? loCert.SubjectCN
        ENDIF

    NEXT
ENDIF


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

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