Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Create S/MIME Detached Signature with PFXHow to use a PFX to create a signed S/MIME message. 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 #include <CkMime.h> #include <CkCertStore.h> #include <CkString.h> #include <CkCert.h> void ChilkatSample(void) { CkMime mime; bool success; success = mime.UnlockComponent("Anything for 30-day trial"); if (success == false) { printf("Failed to unlock component\n"); return; } mime.AddHeaderField("Subject","This is a test"); mime.AddHeaderField("Abc","123"); mime.SetBodyFromPlainText("This is the body"); CkCertStore certStore; CkString password; password = "myPassword"; success = certStore.LoadPfxFile("chilkat.pfx",password); if (success == false) { printf("%s\n",certStore.lastErrorText()); return; } CkCert *cert = 0; cert = certStore.FindCertBySubjectCN("Chilkat Software, Inc."); if (cert == 0 ) { printf("Failed to find certificate!\n"); return; } // Display the full distinguished name of the cert. printf("%s\n",cert->subjectDN()); success = mime.AddDetachedSignature(*cert); if (success == false) { printf("%s\n",mime.lastErrorText()); return; } delete cert; printf("%s\n",mime.getMime()); } |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.