Sample code for 30+ languages & platforms
PowerShell

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$crypt = New-Object Chilkat.Crypt2

$p7m_path = "qa_data/p7m/Firma.docx.p7m"
$out_path = "qa_output/Firma.docx"

$success = $crypt.VerifyP7M($p7m_path,$out_path)
if ($success -eq $false) {
    $($crypt.LastErrorText)
    exit
}

# Examine the certificate(s) used for signing.
$numSigners = $crypt.NumSignerCerts
$i = 0

$cert = New-Object Chilkat.Cert

while ($i -lt $numSigners) {
    $crypt.LastSignerCert($i,$cert)
    $("Signer: " + $cert.SubjectDN)
    $i = $i + 1
}