pub fn verify(
data: &str,
signature: &str,
public_key_str: &str,
encoding: &str,
) -> Result<bool>Expand description
High-level RSA signature verification function for CLI use.
This function takes a message, signature, and public key, then verifies the digital signature using RSA with PKCS#1 v1.5 padding scheme.
§Arguments
data- The original message that was signedsignature- The digital signature (in specified encoding)public_key_str- Public key in “n:e” format or PEM formatencoding- Input encoding: “base64” or “hex”
§Returns
Returns true if the signature is valid, false otherwise.
§Examples
use ruscrypt::asym::rsa;
let message = "Hello, World!";
let signature = "..."; // Base64 signature
let public_key = "12345:65537"; // n:e format
let is_valid = rsa::verify(message, signature, public_key, "base64").unwrap();