Zig
Zig
Example: Crypt2.AddPfxSourceBd method
Demonstrates how to call the AddPfxSourceBd method.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 crypt = try chilkat.Crypt2.init();
defer crypt.deinit();
// Do public-key decryption (RSA)
crypt.setCryptAlgorithm("pki");
// ...
// ...
// ...
const bd_pfx = try chilkat.BinData.init();
defer bd_pfx.deinit();
try bd_pfx.loadFile("c:/my_pfx_files/a.pfx");
// ...
var pfx_password: [:0]const u8 = "secret1";
crypt.addPfxSourceBd(bd_pfx, pfx_password) catch {
std.debug.print("{s}\n", .{try crypt.getLastErrorText(alloc)});
return;
};
// Add as many as PFX sources as desired...
try bd_pfx.loadFile("c:/my_pfx_files/b.pfx");
pfx_password = "secret2";
crypt.addPfxSourceBd(bd_pfx, pfx_password) catch {
std.debug.print("{s}\n", .{try crypt.getLastErrorText(alloc)});
return;
};
// ...
// ...
}