pub fn verify_signature(
    edpk: &ed25519_dalek::PublicKey,
    sig: &ed25519_dalek::Signature,
    parts: &[&[u8]],
) -> Result<(), Error> {
    let mut verify_buf: Vec<u8> = Vec::new();
    let verify: &[u8];
    if parts.len() == 1 {
        verify = &parts[0];
    } else {
        verify_buf.reserve_exact(parts.iter().map(|&x| x.len()).sum());
        for &x in parts {
            verify_buf.extend_from_slice(x);
        }
        verify = &verify_buf;
    }

    if let Err(sigerr) = edpk.verify_strict(verify, &sig) {
        warn!("Request signature verification failed: {}", sigerr);
        return Err(Error::ValidationFailed);
    }
    Ok(())
}
// Verifies a signature over the given byte parts, concatenated together.
Verifies a signature over the given byte parts, concatenated together.
Verifies a signature over the given byte parts concatenated together .
pub fn verify_signature(
    edpk: &ed25519_dalek::PublicKey,
    sig: &ed25519_dalek::Signature,
    parts: &[&[u8]],
) -> Result<(), Error> {
    let mut verify_buf: Vec<u8> = Vec::new();
    let verify: &[u8];
    if parts.len() == 1 {
        verify = &parts[0];
    } else {
        verify_buf.reserve_exact(parts.iter().map(|&x| x.len()).sum());
        for &x in parts {
            verify_buf.extend_from_slice(x);
        }
        verify = &verify_buf;
    }
    if let Err(sigerr) = edpk.verify_strict(verify, &sig) {
        warn!("Request signature verification failed: {}", sigerr);
        return Err(Error::ValidationFailed);
    }
    Ok(())
}
pub fn verify_signature ( edpk : & ed25519_dalek :: PublicKey , sig : & ed25519_dalek :: Signature , parts : & [ & [ u8 ] ] , ) -> Result < ( ) , Error > { let mut verify_buf : Vec < u8 > = Vec :: new ( ) ; let verify : & [ u8 ] ; if parts . len ( ) == 1 { verify = & parts [ 0 ] ; } else { verify_buf . reserve_exact ( parts . iter ( ) . map ( | & x | x . len ( ) ) . sum ( ) ) ; for & x in parts { verify_buf . extend_from_slice ( x ) ; } verify = & verify_buf ; } if let Err ( sigerr ) = edpk . verify_strict ( verify , & sig ) { warn ! ( " " sigerr ) ; return Err ( Error :: ValidationFailed ) ; } Ok ( ( ) ) }
Verifies a signature over the given byte parts, concatenated together.
Verifies a signature over the given byte parts concatenated together .
edpk
&ed25519_dalek::PublicKey
sig
&ed25519_dalek::Signature
parts
&[&[u8]]
edpk
&ed25519_dalek::PublicKey
sig
&ed25519_dalek::Signature
parts
&[&[u8]]