(Java) Example: Crypt2.LastSignerCert method
Demonstrates how to call the LastSignerCert method. Note: This example requires Chilkat v11.0.0 or greater.
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkCrypt2 crypt = new CkCrypt2();
String p7m_path = "qa_data/p7m/Firma.docx.p7m";
String out_path = "qa_output/Firma.docx";
boolean success = crypt.VerifyP7M(p7m_path,out_path);
if (success == false) {
System.out.println(crypt.lastErrorText());
return;
}
// Examine the certificate(s) used for signing.
int numSigners = crypt.get_NumSignerCerts();
int i = 0;
CkCert cert = new CkCert();
while (i < numSigners) {
crypt.LastSignerCert(i,cert);
System.out.println("Signer: " + cert.subjectDN());
i = i+1;
}
}
}
|