fn verify_ring(
    alg: &dyn signature::VerificationAlgorithm,
    signature: &str,
    signing_input: &str,
    key: &[u8],
) -> Result<bool> {
    let signature_bytes = base64::decode_config(signature, base64::URL_SAFE_NO_PAD)?;
    let public_key_der = untrusted::Input::from(key);
    let message = untrusted::Input::from(signing_input.as_bytes());
    let expected_signature = untrusted::Input::from(signature_bytes.as_slice());

    let res = signature::verify(alg, public_key_der, message, expected_signature);

    Ok(res.is_ok())
}
/// See Ring docs for more details
See Ring docs for more details
See Ring docs for more details
fn verify_ring(
    alg: &dyn signature::VerificationAlgorithm,
    signature: &str,
    signing_input: &str,
    key: &[u8],
) -> Result<bool> {
    let signature_bytes = base64::decode_config(signature, base64::URL_SAFE_NO_PAD)?;
    let public_key_der = untrusted::Input::from(key);
    let message = untrusted::Input::from(signing_input.as_bytes());
    let expected_signature = untrusted::Input::from(signature_bytes.as_slice());
    let res = signature::verify(alg, public_key_der, message, expected_signature);
    Ok(res.is_ok())
}
fn verify_ring ( alg : & dyn signature :: VerificationAlgorithm , signature : & str , signing_input : & str , key : & [ u8 ] , ) -> Result < bool > { let signature_bytes = base64 :: decode_config ( signature , base64 :: URL_SAFE_NO_PAD ) ? ; let public_key_der = untrusted :: Input :: from ( key ) ; let message = untrusted :: Input :: from ( signing_input . as_bytes ( ) ) ; let expected_signature = untrusted :: Input :: from ( signature_bytes . as_slice ( ) ) ; let res = signature :: verify ( alg , public_key_der , message , expected_signature ) ; Ok ( res . is_ok ( ) ) }
See Ring docs for more details
See Ring docs for more details
alg
&dyn signature::VerificationAlgorithm
signature
&str
signing_input
&str
key
&[u8]