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

Example: Crypt2.LastSignerCert method

Demonstrates how to call the LastSignerCert method.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.Cert;
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Crypt2;

public class ChilkatExample {

    public static void main(String[] args) {
        Crypt2 crypt = new Crypt2();

        String p7m_path = "qa_data/p7m/Firma.docx.p7m";
        String out_path = "qa_output/Firma.docx";

        try {
            crypt.verifyP7M(p7m_path, out_path);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

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

        Cert cert = new Cert();

        while (i < numSigners) {
            crypt.lastSignerCert(i, cert);
            System.out.println("Signer: " + cert.getSubjectDN());
            i = i + 1;
        }
    }
}