Programming Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
Diffie-Hellman
DSA
Email Object
Encryption
FileAccess
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
MIME
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip


 

 

 

 

 

 

 

 

S/MIME Signed Message

Create an S/MIME signed (PKCS7) message.

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

#include <C_CkMime.h>
#include <C_CkCert.h>

void ChilkatSample(void)
    {
    HCkMime mime;
    BOOL success;
    HCkCert cert;

    mime = CkMime_Create();

    success = CkMime_UnlockComponent(mime,"Anything for 30-day trial.");
    if (success == FALSE) {
        printf("%s\n",CkMime_lastErrorText(mime));
        return;
    }

    CkMime_AddHeaderField(mime,"Subject","This is a test");
    CkMime_AddHeaderField(mime,"Abc","123");

    CkMime_SetBodyFromPlainText(mime,"This is the body");

    cert = CkCert_Create();
    //  Load a certificate that has already been installed (from a .pfx)
    //  on the computer:
    success = CkCert_LoadByEmailAddress(cert,"thawte@chilkatsoft.com");
    if (success == FALSE) {
        printf("%s\n",CkCert_lastErrorText(cert));
        return;
    }

    //  Convert to a signed message.
    success = CkMime_ConvertToSigned(mime,cert);
    if (success == FALSE) {
        printf("%s\n",CkMime_lastErrorText(mime));
        return;
    }

    //  Display the signed MIME:
    printf("%s\n",CkMime_getMime(mime));

    printf("----\n");

    //  Unwrap to restore the original MIME.
    success = CkMime_UnwrapSecurity(mime);
    if (success == FALSE) {
        printf("%s\n",CkMime_lastErrorText(mime));
        return;
    }

    //  Display the restored (unsigned) MIME:
    printf("%s\n",CkMime_getMime(mime));


    CkMime_Dispose(mime);
    CkCert_Dispose(cert);

    }

Need a specific example? Send a request to support@chilkatsoft.com

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