Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
S/MIME Signed MessageCreate an S/MIME signed (PKCS7) message.
#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.