Sample code for 30+ languages & platforms
C++

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat C++ Downloads

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

void ChilkatSample(void)
    {
    bool success = false;

    CkCrypt2 crypt;

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

    success = crypt.VerifyP7M(p7m_path,out_path);
    if (success == false) {
        std::cout << crypt.lastErrorText() << "\r\n";
        return;
    }

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

    CkCert cert;

    while (i < numSigners) {
        crypt.LastSignerCert(i,cert);
        std::cout << "Signer: " << cert.subjectDN() << "\r\n";
        i = i + 1;
    }
    }