Sample code for 30+ languages & platforms
Unicode C++

Example: Crypt2.SetSigningCert method

Demonstrates how to call the SetSigningCert method.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkCrypt2W.h>
#include <CkCertW.h>

void ChilkatSample(void)
    {
    bool success = false;

    //  Signing certificates can be obtained from many different sources..

    //  Load from a PFX
    CkCrypt2W cryptA;
    CkCertW certA;
    success = certA.LoadPfxFile(L"c:/someDir/pfx_files/a.pfx",L"pfx_file_password");
    success = cryptA.SetSigningCert(certA);
    //  ...

    //  Load from a smart card or USB token.
    CkCrypt2W cryptB;
    CkCertW certB;
    certB.put_SmartCardPin(L"123456");
    success = certB.LoadFromSmartcard(L"");
    success = cryptB.SetSigningCert(certB);
    //  ...

    //  Load from a the Windows certificate store or macOS keychain
    CkCrypt2W cryptC;
    CkCertW certC;
    success = certC.LoadByCommonName(L"Xyz 123");
    success = cryptC.SetSigningCert(certC);
    //  ...
    }