Rust Requires Chilkat v11.0.0+
Rust
Base64url Encoding
See more Encryption Examples
Base64url encoding is identical to base64 encoding except it uses non-reserved URL characters (e.g. '–' is used instead of '+', and '_' is used instead of '/') and it omits the padding characters.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let pkey = chilkat::PrivateKey::new();
let rsa = chilkat::Rsa::new();
let _ = rsa.gen_key(1024, &pkey);
let _ = rsa.use_private_key(&pkey);
let str_data = "This is the string to be signed.".to_string();
// Get the signature in base64url
rsa.set_encoding_mode("base64url");
let str_sig = rsa.sign_string_enc(&str_data, "sha256").unwrap_or_default();
println!("{}", str_sig);