GroupPrivateKey

Struct GroupPrivateKey 

Source
pub struct GroupPrivateKey { /* private fields */ }
Expand description

A group private key.

In normal FROST usage, the group private key is not supposed to be kept anywhere once the private key shares have been computed. In single-signer usage, the group private key is handled like a normal cryptographic private key.

Implementations§

Source§

impl GroupPrivateKey

Source

pub const ENC_LEN: usize = 32usize

Encoded private key length (in bytes).

Source

pub fn generate<T: CryptoRng + RngCore>(rng: &mut T) -> Self

Generates a new (group) private key.

A private key is a randomly selected non-zero scalar.

Source

pub fn get_public_key(self) -> GroupPublicKey

Gets the public key corresponding to this private key.

Source

pub fn encode(self) -> [u8; 32]

Encodes this private key into bytes.

In normal FROST usage, group private keys are only transient in-memory object discarded at the end of the key split process. Private key encoding is meant to support single-signer FROST usage.

Source

pub fn decode(buf: &[u8]) -> Option<Self>

Decodes this private key from bytes.

This function may fail (i.e. return None) if the source does not have the length of an encoded private key, or if the provided bytes are not a proper canonical encoding for a non-zero scalar.

Source

pub fn sign<T: CryptoRng + RngCore>(self, rng: &mut T, msg: &[u8]) -> Signature

Generates a signature (single-signer version).

This function uses the (group) private key to sign the provided message. The signature is randomized, though it also uses a derandomization process internally so that safety is maintained even if the provided random generator has poor quality.

Source

pub fn sign_seeded(self, seed: &[u8], msg: &[u8]) -> Signature

Generates a signature (single-signer version, seeded).

This function uses the (group) private key to sign the provided message. The signature uses an internal derandomization process to compute the per-signature nonce; an additional seed can be provided, which is integrated in that process. If that extra seed is fixed (e.g. it is empty), then the signature is deterministic (but still safe).

Trait Implementations§

Source§

impl Clone for GroupPrivateKey

Source§

fn clone(&self) -> GroupPrivateKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GroupPrivateKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for GroupPrivateKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.