Sample code for 30+ languages & platforms
Rust

Example: Crypt2.ClearSigningCerts method

Demonstrates how to call the ClearSigningCerts method.

Chilkat Rust Downloads

Rust

let crypt = chilkat::Crypt2::new();
let _ = false;

// Tell the crypt object to use 3 certificates.
// Do this by calling AddSigningCert for each certificate.

let cert1 = chilkat::Cert::new();
// ...
// Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
// ...
let _ = crypt.add_signing_cert(&cert1);

let cert2 = chilkat::Cert::new();
// ...
let _ = crypt.add_signing_cert(&cert2);

let cert3 = chilkat::Cert::new();
// ...
let _ = crypt.add_signing_cert(&cert3);

let bd = chilkat::BinData::new();
// ...

let _ = crypt.opaque_sign_bd(&bd).is_ok();

// Let's say we now want to sign something else with different certs..
// First clear the signing certs.
crypt.clear_signing_certs();

let cert4 = chilkat::Cert::new();
// ...
let _ = crypt.add_signing_cert(&cert4);

let cert5 = chilkat::Cert::new();
// ...
let _ = crypt.add_signing_cert(&cert5);

// ...
// ...

// Sign using cert4 and cert5.
let _ = crypt.opaque_sign_bd(&bd).is_ok();