Sample code for 30+ languages & platforms
Zig

Load a Certificate from the Windows Certificate Store

See more Certificates Examples

Demonstrates how to load a certificate that has been pre-installed in the registry-based Windows certificate store. This is generally how one would load a certificate that is stored on a smart card or usb token.

Chilkat Zig Downloads

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

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const cert = try chilkat.Cert.init();
    defer cert.deinit();

    cert.loadByCommonName("PIVKey 7ED53EC611D3F84396212C5842BB563F") catch {
        std.debug.print("{s}\n", .{try cert.getLastErrorText(alloc)});
        return;
    };

    std.debug.print("Loaded: {s}\n", .{try cert.getSubjectDN(alloc)});
}