Sample code for 30+ languages & platforms
PHP Requires Chilkat v11.0.0+

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Cert;
use Chilkat2\Crypt2;

$crypt = new Crypt2();

$p7m_path = 'qa_data/p7m/Firma.docx.p7m';
$out_path = 'qa_output/Firma.docx';

try {
    $crypt->VerifyP7M($p7m_path, $out_path);
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

// Examine the certificate(s) used for signing.
$numSigners = $crypt->NumSignerCerts;
$i = 0;

$cert = new Cert();

while ($i < $numSigners) {
    $crypt->LastSignerCert($i, $cert);
    echo 'Signer: ', $cert->SubjectDN, "\n";
    $i = $i + 1;
}