/// Validates a node's DKG dealing encryption key
///
/// See the crate documentation for the exact checks that are performed.
Validates a node's DKG dealing encryption key
See the crate documentation for the exact checks that are performed.
Validates a node ' s DKG dealing encryption key See the crate documentation for the exact checks that are performed .
fn validate_dkg_dealing_encryption_key(
    dkg_dealing_encryption_key: &Option<PublicKey>,
    node_id: NodeId,
) -> Result<(), KeyValidationError> {
    let pubkey_proto = dkg_dealing_encryption_key
        .as_ref()
        .ok_or_else(|| invalid_dkg_dealing_enc_pubkey_error("key is missing"))?;
    // Note: `fs_ni_dkg_pubkey_from_proto` also ensures that the
    // public key is a point on the curve and in the right subgroup.
    let fs_ni_dkg_pubkey = fs_ni_dkg_pubkey_from_proto(pubkey_proto)
        .map_err(|e| invalid_dkg_dealing_enc_pubkey_error(format!("{}", e)))?;
    if !fs_ni_dkg_pubkey.verify(node_id.get().as_slice()) {
        return Err(invalid_dkg_dealing_enc_pubkey_error("verification failed"));
    }
    Ok(())
}
fn validate_dkg_dealing_encryption_key ( dkg_dealing_encryption_key : & Option < PublicKey > , node_id : NodeId , ) -> Result < ( ) , KeyValidationError > { let pubkey_proto = dkg_dealing_encryption_key . as_ref ( ) . ok_or_else ( | | invalid_dkg_dealing_enc_pubkey_error ( " " ) ) ? ; // Note: `fs_ni_dkg_pubkey_from_proto` also ensures that the // public key is a point on the curve and in the right subgroup. let fs_ni_dkg_pubkey = fs_ni_dkg_pubkey_from_proto ( pubkey_proto ) . map_err ( | e | invalid_dkg_dealing_enc_pubkey_error ( format ! ( " " e ) ) ) ? ; if ! fs_ni_dkg_pubkey . verify ( node_id . get ( ) . as_slice ( ) ) { return Err ( invalid_dkg_dealing_enc_pubkey_error ( " " ) ) ; } Ok ( ( ) ) }
Validates a node's DKG dealing encryption key
See the crate documentation for the exact checks that are performed.
Validates a node ' s DKG dealing encryption key See the crate documentation for the exact checks that are performed .
dkg_dealing_encryption_key
&Option<PublicKey>
node_id
NodeId