/// Verifies a dealing created to reshare an existing secret.
///
/// Also cf. `verify_dealing`.
///
/// # Arguments
/// * `dkg_id` - Unused.
/// * `dealer_resharing_index` - The index of the dealer that provided the given
///   `dealing`.
/// * `threshold` - The threshold required by the given `dealing`.
/// * `epoch` - The forward-secure encryption epoch used to encrypt the
///   receivers' shares.
/// * `receiver_keys` - The forward-secure encryption public keys used to
///   encrypt the receivers' shares.
/// * `dealing` - The dealing to verify.
/// * `resharing_public_coefficients` - The `PublicCoefficients` corresponding
///   to the secret share that is being re-shared.
///
/// # Errors
/// * Same errors as `verify_dealing`.
/// * `CspDkgVerifyDealingError::InvalidDealingError` if the constant term in
///   the public coefficient doesn't equal the individual public key of the
///   dealer in the resharing instance.
/// * `CspDkgVerifyDealingError::InvalidDealingError` if the dealer's public key
///   is malformed.
///
/// # Panics
/// * If there are no `public_coefficients` in `dealing`.
Verifies a dealing created to reshare an existing secret.
Also cf.
Verifies a dealing created to reshare an existing secret . Also cf .
pub fn verify_resharing_dealing(
    dkg_id: NiDkgId,
    dealer_resharing_index: NodeIndex,
    threshold: NumberOfNodes,
    epoch: Epoch,
    receiver_keys: &BTreeMap<NodeIndex, FsEncryptionPublicKey>,
    dealing: &Dealing,
    resharing_public_coefficients: &PublicCoefficientsBytes,
) -> Result<(), CspDkgVerifyDealingError> {
    verify_dealing(
        dkg_id,
        dealer_resharing_index,
        threshold,
        epoch,
        receiver_keys,
        dealing,
    )?;
    // Check the constant term in the public coefficient corresponds to the
    // individual public key of the dealer in the resharing instance
    let dealt_public_key = dealing
        .public_coefficients
        .coefficients
        .get(0)
        .expect("verify_dealing guarantees that public_coefficients.len() == threshold > 0");
    let reshared_public_key =
        individual_public_key(resharing_public_coefficients, dealer_resharing_index).map_err(
            |error| {
                let error = InvalidArgumentError {
                    message: format!("{}", error),
                };
                CspDkgVerifyDealingError::InvalidDealingError(error)
            },
        )?;
    if *dealt_public_key != reshared_public_key {
        let error = InvalidDealingError::ReshareMismatch {
            old: reshared_public_key,
            new: *dealt_public_key,
        };
        let error = InvalidArgumentError::from(error);
        return Err(CspDkgVerifyDealingError::InvalidDealingError(error));
    }
    Ok(())
}
pub fn verify_resharing_dealing ( dkg_id : NiDkgId , dealer_resharing_index : NodeIndex , threshold : NumberOfNodes , epoch : Epoch , receiver_keys : & BTreeMap < NodeIndex , FsEncryptionPublicKey > , dealing : & Dealing , resharing_public_coefficients : & PublicCoefficientsBytes , ) -> Result < ( ) , CspDkgVerifyDealingError > { verify_dealing ( dkg_id , dealer_resharing_index , threshold , epoch , receiver_keys , dealing , ) ? ; // Check the constant term in the public coefficient corresponds to the // individual public key of the dealer in the resharing instance let dealt_public_key = dealing . public_coefficients . coefficients . get ( 0 ) . expect ( " " ) ; let reshared_public_key = individual_public_key ( resharing_public_coefficients , dealer_resharing_index ) . map_err ( | error | { let error = InvalidArgumentError { message : format ! ( " " error ) , } ; CspDkgVerifyDealingError :: InvalidDealingError ( error ) } , ) ? ; if * dealt_public_key != reshared_public_key { let error = InvalidDealingError :: ReshareMismatch { old : reshared_public_key , new : * dealt_public_key , } ; let error = InvalidArgumentError :: from ( error ) ; return Err ( CspDkgVerifyDealingError :: InvalidDealingError ( error ) ) ; } Ok ( ( ) ) }
Verifies a dealing created to reshare an existing secret.
Verifies a dealing created to reshare an existing secret .
dkg_id
NiDkgId
dealer_resharing_index
NodeIndex
threshold
NumberOfNodes
epoch
Epoch
receiver_keys
&BTreeMap<NodeIndex, FsEncryptionPublicKey>
dealing
&Dealing
resharing_public_coefficients
&PublicCoefficientsBytes
errors
Same errors as `verify_dealing`.
`CspDkgVerifyDealingError::InvalidDealingError` if the constant term in
the public coefficient doesn't equal the individual public key of the
dealer in the resharing instance.
`CspDkgVerifyDealingError::InvalidDealingError` if the dealer's public key
is malformed.
Same errors as ` verify_dealing ` . ` CspDkgVerifyDealingError :: InvalidDealingError ` if the constant term in the public coefficient doesn ' t equal the individual public key of the dealer in the resharing instance . ` CspDkgVerifyDealingError :: InvalidDealingError ` if the dealer ' s public key is malformed .
panics
If there are no `public_coefficients` in `dealing`.
If there are no ` public_coefficients ` in ` dealing ` .