Struct miden_crypto::dsa::rpo_falcon512::KeyPair
source · pub struct KeyPair { /* private fields */ }
Expand description
A key pair (public and secret keys) for signing messages.
The secret key is a byte array of length [PK_LEN]. The public key is a byte array of length [SK_LEN].
Implementations§
source§impl KeyPair
impl KeyPair
sourcepub fn new() -> Result<Self, FalconError>
pub fn new() -> Result<Self, FalconError>
Generates a (public_key, secret_key) key pair from OS-provided randomness.
Errors
Returns an error if key generation fails.
sourcepub fn from_seed(seed: &[u8; 40]) -> Result<Self, FalconError>
pub fn from_seed(seed: &[u8; 40]) -> Result<Self, FalconError>
Generates a (public_key, secret_key) key pair from the provided seed.
Errors
Returns an error if key generation fails.
sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
Returns the public key corresponding to this key pair.
sourcepub fn expanded_public_key(&self) -> [u8; 897]
pub fn expanded_public_key(&self) -> [u8; 897]
Returns the expanded public key corresponding to this key pair.
Trait Implementations§
source§impl Deserializable for KeyPair
impl Deserializable for KeyPair
source§fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R ) -> Result<Self, DeserializationError>
Reads a sequence of bytes from the provided
source
, attempts to deserialize these bytes
into Self
, and returns the result. Read moresource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
source§fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self>, DeserializationError>where
R: ByteReader,
fn read_batch_from<R>( source: &mut R, num_elements: usize ) -> Result<Vec<Self>, DeserializationError>where R: ByteReader,
Reads a sequence of bytes from the provided
source
, attempts to deserialize these bytes
into a vector with the specified number of Self
elements, and returns the result. Read moresource§impl PartialEq for KeyPair
impl PartialEq for KeyPair
source§impl Serializable for KeyPair
impl Serializable for KeyPair
source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes
self
into bytes and writes these bytes into the target
.source§fn write_batch_into<W>(source: &[Self], target: &mut W)where
W: ByteWriter,
fn write_batch_into<W>(source: &[Self], target: &mut W)where W: ByteWriter,
source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
impl Copy for KeyPair
impl StructuralPartialEq for KeyPair
Auto Trait Implementations§
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more