Sample code for 30+ languages & platforms
Zig

Example: Crypt2.SetSigningCert method

Demonstrates how to call the SetSigningCert method.

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main() !void {
    // Signing certificates can be obtained from many different sources..

    // Load from a PFX
    const crypt_a = try chilkat.Crypt2.init();
    defer crypt_a.deinit();
    const cert_a = try chilkat.Cert.init();
    defer cert_a.deinit();
    try cert_a.loadPfxFile("c:/someDir/pfx_files/a.pfx", "pfx_file_password");
    try crypt_a.setSigningCert(cert_a);
    // ...

    // Load from a smart card or USB token.
    const crypt_b = try chilkat.Crypt2.init();
    defer crypt_b.deinit();
    const cert_b = try chilkat.Cert.init();
    defer cert_b.deinit();
    cert_b.setSmartCardPin("123456");
    try cert_b.loadFromSmartcard("");
    try crypt_b.setSigningCert(cert_b);
    // ...

    // Load from a the Windows certificate store or macOS keychain
    const crypt_c = try chilkat.Crypt2.init();
    defer crypt_c.deinit();
    const cert_c = try chilkat.Cert.init();
    defer cert_c.deinit();
    try cert_c.loadByCommonName("Xyz 123");
    try crypt_c.setSigningCert(cert_c);
    // ...
}