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
impl GroupPrivateKey
Sourcepub fn generate<T: CryptoRng + RngCore>(rng: &mut T) -> Self
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.
Sourcepub fn get_public_key(self) -> GroupPublicKey
pub fn get_public_key(self) -> GroupPublicKey
Gets the public key corresponding to this private key.
Sourcepub fn encode(self) -> [u8; 32]
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.
Sourcepub fn decode(buf: &[u8]) -> Option<Self>
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.
Sourcepub fn sign<T: CryptoRng + RngCore>(self, rng: &mut T, msg: &[u8]) -> Signature
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.
Sourcepub fn sign_seeded(self, seed: &[u8], msg: &[u8]) -> Signature
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
impl Clone for GroupPrivateKey
Source§fn clone(&self) -> GroupPrivateKey
fn clone(&self) -> GroupPrivateKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more