Sample code for 30+ languages & platforms
C++

Example: Crypt2.SetSigningCert method

Demonstrates how to call the SetSigningCert method.

Chilkat C++ Downloads

C++
#include <CkCrypt2.h>
#include <CkCert.h>

void ChilkatSample(void)
    {
    bool success = false;

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

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

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

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