Zig Requires Chilkat v11.0.0+
Zig
Example: Crypt2.LastSignerCert method
Demonstrates how to call the LastSignerCert method.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
const crypt = try chilkat.Crypt2.init();
defer crypt.deinit();
const p7m_path = "qa_data/p7m/Firma.docx.p7m";
const out_path = "qa_output/Firma.docx";
crypt.verifyP7M(p7m_path, out_path) catch {
std.debug.print("{s}\n", .{try crypt.getLastErrorText(alloc)});
return;
};
// Examine the certificate(s) used for signing.
const num_signers = crypt.getNumSignerCerts();
var i: i32 = 0;
const cert = try chilkat.Cert.init();
defer cert.deinit();
while (i < num_signers) {
crypt.lastSignerCert(i, cert) catch {};
std.debug.print("Signer: {s}\n", .{try cert.getSubjectDN(alloc)});
i = i + 1;
}
}