Zig
Zig
Example: Crypt2.ClearSigningCerts method
Demonstrates how to call the ClearSigningCerts method.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main() !void {
const crypt = try chilkat.Crypt2.init();
defer crypt.deinit();
// Tell the crypt object to use 3 certificates.
// Do this by calling AddSigningCert for each certificate.
const cert1 = try chilkat.Cert.init();
defer cert1.deinit();
// ...
// Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
// ...
crypt.addSigningCert(cert1) catch {};
const cert2 = try chilkat.Cert.init();
defer cert2.deinit();
// ...
crypt.addSigningCert(cert2) catch {};
const cert3 = try chilkat.Cert.init();
defer cert3.deinit();
// ...
crypt.addSigningCert(cert3) catch {};
const bd = try chilkat.BinData.init();
defer bd.deinit();
// ...
try crypt.opaqueSignBd(bd);
// Let's say we now want to sign something else with different certs..
// First clear the signing certs.
crypt.clearSigningCerts();
const cert4 = try chilkat.Cert.init();
defer cert4.deinit();
// ...
crypt.addSigningCert(cert4) catch {};
const cert5 = try chilkat.Cert.init();
defer cert5.deinit();
// ...
crypt.addSigningCert(cert5) catch {};
// ...
// ...
// Sign using cert4 and cert5.
try crypt.opaqueSignBd(bd);
}