Zig
Zig
Convert Certificate from DER to PEM.
See more Certificates Examples
Loads a digital certificate from any format, such as DER, and saves to PEM format.Chilkat Zig Downloads
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();
// LoadFromFile will load virtually any certificate format file.
// It will auto-recognize the format and load appropiately.
// In this case, load a DER format certificate and convert to PEM.
cert.loadFromFile("qa_data/certs/testCert.cer") catch {
std.debug.print("{s}\n", .{try cert.getLastErrorText(alloc)});
return;
};
cert.exportCertPemFile("qa_data/certs/testCert.pem") catch {
std.debug.print("{s}\n", .{try cert.getLastErrorText(alloc)});
return;
};
std.debug.print("Converted certificate from DER to PEM format.\n", .{});
}