pub fn verify_membership(
        &self,
        backend: &impl OpenMlsCryptoProvider,
        serialized_context: &[u8],
        membership_key: &MembershipKey,
    ) -> Result<(), MlsPlaintextError> {
        log::debug!("Verifying membership tag.");
        log_crypto!(trace, "  Membership key: {:x?}", membership_key);
        log_crypto!(trace, "  Serialized context: {:x?}", serialized_context);
        let tbs_payload = encode_tbs(self, serialized_context)?;
        let tbm_payload =
            MlsPlaintextTbmPayload::new(&tbs_payload, &self.signature, &self.confirmation_tag)?;
        let expected_membership_tag = &membership_key.tag(backend, tbm_payload)?;

        // Verify the membership tag
        if let Some(membership_tag) = &self.membership_tag {
            // TODO #133: make this a constant-time comparison
            if membership_tag != expected_membership_tag {
                return Err(VerificationError::InvalidMembershipTag.into());
            }
        } else {
            return Err(VerificationError::MissingMembershipTag.into());
        }
        Ok(())
    }
/// Verify the membership tag of an `MlsPlaintext` sent from a group member.
/// Returns `Ok(())` if successful or `VerificationError` otherwise.
/// Note that the signature must have been verified before.
// TODO #133: Include this in the validation
Verify the membership tag of an `MlsPlaintext` sent from a group member.
Returns `Ok(())` if successful or `VerificationError` otherwise.
Note that the signature must have been verified before.
TODO #133: Include this in the validation
Verify the membership tag of an ` MlsPlaintext ` sent from a group member . Returns ` Ok (( )) ` if successful or ` VerificationError ` otherwise . Note that the signature must have been verified before . TODO #133 : Include this in the validation
pub fn verify_membership(
        &self,
        backend: &impl OpenMlsCryptoProvider,
        serialized_context: &[u8],
        membership_key: &MembershipKey,
    ) -> Result<(), MlsPlaintextError> {
        log::debug!("Verifying membership tag.");
        log_crypto!(trace, "  Membership key: {:x?}", membership_key);
        log_crypto!(trace, "  Serialized context: {:x?}", serialized_context);
        let tbs_payload = encode_tbs(self, serialized_context)?;
        let tbm_payload =
            MlsPlaintextTbmPayload::new(&tbs_payload, &self.signature, &self.confirmation_tag)?;
        let expected_membership_tag = &membership_key.tag(backend, tbm_payload)?;
        // Verify the membership tag
        if let Some(membership_tag) = &self.membership_tag {
            // TODO #133: make this a constant-time comparison
            if membership_tag != expected_membership_tag {
                return Err(VerificationError::InvalidMembershipTag.into());
            }
        } else {
            return Err(VerificationError::MissingMembershipTag.into());
        }
        Ok(())
    }
pub fn verify_membership ( & self , backend : & impl OpenMlsCryptoProvider , serialized_context : & [ u8 ] , membership_key : & MembershipKey , ) -> Result < ( ) , MlsPlaintextError > { log :: debug ! ( " " ) ; log_crypto ! ( trace " " membership_key ) ; log_crypto ! ( trace " " serialized_context ) ; let tbs_payload = encode_tbs ( self , serialized_context ) ? ; let tbm_payload = MlsPlaintextTbmPayload :: new ( & tbs_payload , & self . signature , & self . confirmation_tag ) ? ; let expected_membership_tag = & membership_key . tag ( backend , tbm_payload ) ? ; // Verify the membership tag if let Some ( membership_tag ) = & self . membership_tag { // TODO #133: make this a constant-time comparison if membership_tag != expected_membership_tag { return Err ( VerificationError :: InvalidMembershipTag . into ( ) ) ; } } else { return Err ( VerificationError :: MissingMembershipTag . into ( ) ) ; } Ok ( ( ) ) }
Verify the membership tag of an `MlsPlaintext` sent from a group member.
Verify the membership tag of an ` MlsPlaintext ` sent from a group member .
&self
backend
&impl OpenMlsCryptoProvider
serialized_context
&[u8]
membership_key
&MembershipKey
&self
backend
&impl OpenMlsCryptoProvider
serialized_context
&[u8]
membership_key
&MembershipKey