Rust
Rust
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Rust Downloads
let crypt = chilkat::Crypt2::new();
let bd_encrypted = chilkat::BinData::new();
let sb_plain_text = chilkat::StringBuilder::new();
let _ = sb_plain_text.append("Text to be encrypted");
// ...
// Set the secret key ...
// Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
// Set the IV if needed ...
// ...
crypt.set_charset("utf-8");
if crypt.encrypt_sb(&sb_plain_text, &bd_encrypted).is_err() {
println!("{}", crypt.last_error_text());
return;
}