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

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCrypt
LOCAL cP7m_path
LOCAL cOut_path
LOCAL nNumSigners
LOCAL i
LOCAL oCert

nSuccess := 0

oCrypt := CreateObject("Chilkat.Crypt2")

cP7m_path := "qa_data/p7m/Firma.docx.p7m"
cOut_path := "qa_output/Firma.docx"

nSuccess := oCrypt:VerifyP7M(cP7m_path, cOut_path)
IF (nSuccess == 0)
    ? oCrypt:LastErrorText
    oCrypt:destroy()
    RETURN
ENDIF

//  Examine the certificate(s) used for signing.
nNumSigners := oCrypt:NumSignerCerts
i := 0

oCert := CreateObject("Chilkat.Cert")

DO WHILE i < nNumSigners
    oCrypt:LastSignerCert(i, oCert)
    ? "Signer: " + oCert:SubjectDN
    i := i + 1
ENDDO

oCrypt:destroy()
oCert:destroy()