Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

addCert

Chain.addCert
pub fn addCert(chain: *Chain, cert: []const u8) std.Io.UnexpectedError!void

File

Code

pub fn addCert(chain: *Chain, cert: []const u8) std.Io.UnexpectedError!void {
    const store = chain.store orelse store: {
        const store = crypt32.CertOpenStore(
            .MEMORY,
            .{},
            .NULL,
            .{},
            null,
        ) orelse return std.os.windows.unexpectedError(std.os.windows.GetLastError());
        chain.store = store;
        break :store store;
    };
    if (!crypt32.CertAddEncodedCertificateToStore(
        store,
        .{ .CERT = .ASN },
        cert.ptr,
        @intCast(cert.len),
        .ALWAYS,
        if (chain.primary) |_| null else &chain.primary,
    ).toBool()) return std.os.windows.unexpectedError(std.os.windows.GetLastError());
}