[][src]Trait nubls::ThresholdKey

pub trait ThresholdKey: Sized {
    fn split(&self, m: usize, n: usize) -> Vec<Self>;
fn recover(fragments: &[Self]) -> Self;
fn is_fragment(&self) -> bool; }

A trait that describes a key that can be used for threshold cryptography protocols. The key that has this trait implemented on it can be split into n fragments where m fragments (the threshold) must be recovered to re-assemble the full key.

This is done by implementing a secret sharing scheme such as Shamir's Secret Sharing.

Required methods

fn split(&self, m: usize, n: usize) -> Vec<Self>

The split method splits the Threshold key into n fragments with a threshold of m fragments required to re-assemble the full key.

Returns the n fragments in a Vec.

fn recover(fragments: &[Self]) -> Self

The recover function returns the re-assembled key given the threshold m fragments.

fn is_fragment(&self) -> bool

The is_fragment method returns a bool when the PrivateKey is used for a threshold computation.

Loading content...

Implementors

impl ThresholdKey for PrivateKey[src]

Implements Shamir's Secret Sharing (SSS) on PrivateKey for use in Threshold BLS Signatures.

SSS has the property of "perfect secrecy" which means that an attacker who holds m-1 shares of a split key knows nothing; as much info as an attacker who holds none of the shares. These fragments are used as separate, independent private keys in threshold protocols.

fn split(&self, m: usize, n: usize) -> Vec<PrivateKey>[src]

Splits the private key into n fragments and returns them in a Vec by using Shamir's Secret Sharing.

The m value is the threshold number of fragments required to re-assemble a secret. An attacker who knows m-1 fragments knows just as much as an attacker who holds no shares due to the "perfect secrecy" of Shamir's Secret Sharing.

fn recover(fragments: &[PrivateKey]) -> PrivateKey[src]

Recovers a PrivateKey from the fragments provided by calculating Lagrange basis polynomials.

The fragments vector must contain the threshold amount (specified as m in the split method) to successfully recover the key. Due to the "perfect secrecy" of Shamir's Secret Sharing, if fragments does not contain the threshold number of fragments (or the wrong fragments), then this will incorrectly recover the PrivateKey without warning.

fn is_fragment(&self) -> bool[src]

Returns whether or not this is a fragment of a key used for threshold signatures.

Loading content...