Sample code for 30+ languages & platforms
Zig Requires Chilkat v11.0.0+

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

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 http = try chilkat.Http.init();
    defer http.deinit();
    const cert = try chilkat.Cert.init();
    defer cert.deinit();

    http.getServerCert("chilkatsoft.com", 443, cert) catch {
        std.debug.print("{s}\n", .{try http.getLastErrorText(alloc)});
        return;
    };

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

    // Output:

    // CN=*.chilkatsoft.com
    // Wed, 10 Jun 2026 23:59:59 GMT
}