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

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat Unicode C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    CkCrypt2W crypt;

    const wchar_t *p7m_path = L"qa_data/p7m/Firma.docx.p7m";
    const wchar_t *out_path = L"qa_output/Firma.docx";

    success = crypt.VerifyP7M(p7m_path,out_path);
    if (success == false) {
        wprintf(L"%s\n",crypt.lastErrorText());
        return;
    }

    //  Examine the certificate(s) used for signing.
    int numSigners = crypt.get_NumSignerCerts();
    int i = 0;

    CkCertW cert;

    while (i < numSigners) {
        crypt.LastSignerCert(i,cert);
        wprintf(L"Signer: %s\n",cert.subjectDN());
        i = i + 1;
    }
    }