/// Verifies an individual signature over the given `message` using the given
/// `public_key_bytes`.
///
/// # Errors
/// * `CryptoError::MalformedSignature` if `signature_bytes` cannot be parsed as
///   a G1 point.
/// * `CryptoError::MalformedPublicKey` if `public_key_bytes` cannot be parsed
///   as a valid G2 point.
/// * `CryptoError::SignatureVerification` if verification of the signature
///   fails.
Verifies an individual signature over the given `message` using the given
`public_key_bytes`.
Verifies an individual signature over the given ` message ` using the given ` public_key_bytes ` .
pub fn verify_individual(
    message: &[u8],
    signature_bytes: IndividualSignatureBytes,
    public_key_bytes: PublicKeyBytes,
) -> Result<(), CryptoError> {
    let signature = signature_bytes.try_into()?;
    let public_key = public_key_bytes.try_into()?;
    if crypto::verify_individual_message_signature(message, signature, public_key) {
        Ok(())
    } else {
        Err(CryptoError::SignatureVerification {
            algorithm: AlgorithmId::MultiBls12_381,
            public_key_bytes: public_key_bytes.0.to_vec(),
            sig_bytes: signature_bytes.0.to_vec(),
            internal_error: "Verification of individual contribution to multisignature failed"
                .to_string(),
        })
    }
}
pub fn verify_individual ( message : & [ u8 ] , signature_bytes : IndividualSignatureBytes , public_key_bytes : PublicKeyBytes , ) -> Result < ( ) , CryptoError > { let signature = signature_bytes . try_into ( ) ? ; let public_key = public_key_bytes . try_into ( ) ? ; if crypto :: verify_individual_message_signature ( message , signature , public_key ) { Ok ( ( ) ) } else { Err ( CryptoError :: SignatureVerification { algorithm : AlgorithmId :: MultiBls12_381 , public_key_bytes : public_key_bytes . 0 . to_vec ( ) , sig_bytes : signature_bytes . 0 . to_vec ( ) , internal_error : " " . to_string ( ) , } ) } }
Verifies an individual signature over the given `message` using the given
`public_key_bytes`.
Verifies an individual signature over the given ` message ` using the given ` public_key_bytes ` .
message
&[u8]
signature_bytes
IndividualSignatureBytes
public_key_bytes
PublicKeyBytes
errors
`CryptoError::MalformedSignature` if `signature_bytes` cannot be parsed as
a G1 point.
`CryptoError::MalformedPublicKey` if `public_key_bytes` cannot be parsed
as a valid G2 point.
`CryptoError::SignatureVerification` if verification of the signature
fails.
` CryptoError :: MalformedSignature ` if ` signature_bytes ` cannot be parsed as a G1 point . ` CryptoError :: MalformedPublicKey ` if ` public_key_bytes ` cannot be parsed as a valid G2 point . ` CryptoError :: SignatureVerification ` if verification of the signature fails .