[][src]Struct nubls::Signature

pub struct Signature(_, _);

A Signature is an Affine element of the G_2 group on the BLS12-381 curve. We have an Option<Scalar> field for a Fragment ID in the case of Threshold signatures.

Implementations

impl Signature[src]

pub fn to_bytes(&self, buff: &mut [u8])[src]

Serializes the Signature by filling a buffer passed as an argument. If the buffer is not big enough, this method will panic.

A Signature can be serialized in two ways:

  1. 96 bytes -- This is the case when a Signature is not a fragment to a threshold signature.

  2. 128 bytes -- This is the case when a Signature is a fragment to a threshold signature. This allows us to store its fragment ID for Shamir's Secret Sharing.

Note: This serialization will probably change in the future. See https://github.com/nucypher/NuBLS/issues/3

pub fn from_bytes(bytes: &[u8]) -> Signature[src]

Deserializes from a &[u8; 96] to a Signature. This will panic if the input is not canonical.

A Signature can be serialized in two ways:

  1. 96 bytes -- This is the case when a Signature is not a fragment to a threshold signature.

  2. 128 bytes -- This is the case when a Signature is a fragment to a threshold signature. This allows us to store its fragment ID for Shamir's Secret Sharing.

Note: This serialization will probably change in the future. See https://github.com/nucypher/NuBLS/issues/3

Trait Implementations

impl Clone for Signature[src]

impl Copy for Signature[src]

impl Debug for Signature[src]

impl Eq for Signature[src]

impl PartialEq<Signature> for Signature[src]

impl StructuralEq for Signature[src]

impl StructuralPartialEq for Signature[src]

impl ThresholdSignature for Signature[src]

Implements Threshold BLS signatures on Signature.

We use Shamir's Secret Sharing scheme to share n fragments of a PrivateKey where m fragments are needed to recover it. For BLS threshold signatures, this translates to needing m signatures of identical data to assemble the final Signature.

fn assemble(fragments: &[Signature]) -> Signature[src]

Assembles a Signature from collected signature fragments.

Note: The data signed by each of the fragment signatures must be identical, or else the assembled Signature will be invalid.

This calculates the final signature by using Lagrange basis polynomials.

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

Returns whether or not this is a fragment of a threshold signature.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.