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

Extract XML string from a .p7m byte array (e.g. FATTURA ELETTRONICA, ITALY)

See more Digital Signatures Examples

_LANGUAGE_ example to extract the original XML from a .p7m (Signed-Data PKCS7 Format) provided as a byte array.

One use for this example is to extract the original XML from a Fattura Elettronica .p7m signature.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkFileAccessW.h>
#include <CkByteData.h>
#include <CkCrypt2W.h>

void ChilkatSample(void)
    {
    //  This example requires the Chilkat API to have been previously unlocked.
    //  See Global Unlock Sample for sample code.

    CkFileAccessW fac;
    CkByteData p7mBytes;
    success = fac.ReadEntireFile(L"testData/p7m/fattura_signature.p7m",p7mBytes);
    if (fac.get_LastMethodSuccess() != true) {
        wprintf(L"%s\n",fac.lastErrorText());
        return;
    }

    CkCrypt2W crypt;

    const wchar_t *originalXml = crypt.opaqueVerifyString(p7mBytes);
    if (crypt.get_LastMethodSuccess() != true) {
        wprintf(L"%s\n",fac.lastErrorText());
        return;
    }

    wprintf(L"Original XML:\n");
    wprintf(L"%s\n",originalXml);

    wprintf(L"Success!\n");
    }