Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
(C) Add S/MIME Signature using PFXAdd a digital signature to a MIME message using the certificate + private key from a PFX file. Downloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries FreeBSD C++ Libraries HP-UX C++ Libraries BlackBerry QNX C++ Libraries #include <C_CkMime.h> #include <C_CkCert.h> void ChilkatSample(void) { HCkMime mime; BOOL success; HCkCert cert; const char * pfxFilepath; const char * pfxPassword; mime = CkMime_Create(); success = CkMime_UnlockComponent(mime,"Anything for 30-day trial"); if (success == FALSE) { printf("%s\n",CkMime_lastErrorText(mime)); return; } // Load a PFX file into a certificate object. cert = CkCert_Create(); pfxFilepath = "pfxFiles/something.pfx"; pfxPassword = "secret"; success = CkCert_LoadPfxFile(cert,pfxFilepath,pfxPassword); if (success == FALSE) { printf("%s\n",CkCert_lastErrorText(cert)); return; } CkMime_SetBodyFromPlainText(mime,"This is the plain-text MIME body."); CkMime_putCharset(mime,"utf-8"); CkMime_putEncoding(mime,"quoted-printable"); // Sign the MIME (adds a PKCS7 detached signature) success = CkMime_AddDetachedSignature(mime,cert); if (success == FALSE) { printf("%s\n",CkMime_lastErrorText(mime)); return; } // Save the S/MIME to a file. success = CkMime_SaveMime(mime,"/temp/signedMime.txt"); if (success == FALSE) { printf("%s\n",CkMime_lastErrorText(mime)); return; } printf("success!\n"); CkMime_Dispose(mime); CkCert_Dispose(cert); } |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.