pub struct FnDsaKeyPair { /* private fields */ }Expand description
An FN-DSA key pair (private key + public key).
Use logn = 9 for FN-DSA-512 (NIST Level I) or logn = 10
for FN-DSA-1024 (NIST Level V).
The private key bytes are automatically zeroized on drop.
Note: Clone duplicates private key material in memory.
Only clone when you need multiple owners; prefer references otherwise.
Implementations§
Source§impl FnDsaKeyPair
impl FnDsaKeyPair
Sourcepub fn generate(logn: u32) -> Result<Self, FalconError>
pub fn generate(logn: u32) -> Result<Self, FalconError>
Generate a new FN-DSA key pair using OS entropy.
logn— 9 for FN-DSA-512, 10 for FN-DSA-1024.
Sourcepub fn generate_deterministic(
seed: &[u8],
logn: u32,
) -> Result<Self, FalconError>
pub fn generate_deterministic( seed: &[u8], logn: u32, ) -> Result<Self, FalconError>
Generate a key pair deterministically from seed.
Sourcepub fn from_keys(privkey: &[u8], pubkey: &[u8]) -> Result<Self, FalconError>
pub fn from_keys(privkey: &[u8], pubkey: &[u8]) -> Result<Self, FalconError>
Reconstruct from previously exported private + public key bytes.
Sourcepub fn from_private_key(privkey: &[u8]) -> Result<Self, FalconError>
pub fn from_private_key(privkey: &[u8]) -> Result<Self, FalconError>
Reconstruct from a private key only (public key is recomputed).
Sourcepub fn public_key_from_private(privkey: &[u8]) -> Result<Vec<u8>, FalconError>
pub fn public_key_from_private(privkey: &[u8]) -> Result<Vec<u8>, FalconError>
Compute the public key bytes from a private key without creating a key pair.
Sourcepub fn sign(
&self,
message: &[u8],
domain: &DomainSeparation<'_>,
) -> Result<FnDsaSignature, FalconError>
pub fn sign( &self, message: &[u8], domain: &DomainSeparation<'_>, ) -> Result<FnDsaSignature, FalconError>
Sign message using FIPS 206 domain separation.
Supports both pure FN-DSA (DomainSeparation::None /
DomainSeparation::Context) and HashFN-DSA
(DomainSeparation::Prehashed).
§Errors
FalconError::BadArgument— context string > 255 bytes.FalconError::RandomError— OS RNG unavailable.
Sourcepub fn sign_deterministic(
&self,
message: &[u8],
seed: &[u8],
domain: &DomainSeparation<'_>,
) -> Result<FnDsaSignature, FalconError>
pub fn sign_deterministic( &self, message: &[u8], seed: &[u8], domain: &DomainSeparation<'_>, ) -> Result<FnDsaSignature, FalconError>
Sign with a deterministic seed (testing / reproducibility).
The same (key, message, seed, domain) tuple always produces
the same signature.
§Errors
FalconError::BadArgument— context string > 255 bytes.
Sourcepub fn public_key(&self) -> &[u8] ⓘ
pub fn public_key(&self) -> &[u8] ⓘ
Get the encoded public key bytes.
Sourcepub fn private_key(&self) -> &[u8] ⓘ
pub fn private_key(&self) -> &[u8] ⓘ
Get the encoded private key bytes.
⚠️ Secret material — handle with care.
Sourcepub fn logn(&self) -> u32
pub fn logn(&self) -> u32
Get the FN-DSA degree parameter.
Returns 9 for FN-DSA-512, 10 for FN-DSA-1024.
Sourcepub fn variant_name(&self) -> &'static str
pub fn variant_name(&self) -> &'static str
Get the security variant name.
Source§impl FnDsaKeyPair
impl FnDsaKeyPair
Sourcepub fn expand(&self) -> Result<FnDsaExpandedKey, FalconError>
pub fn expand(&self) -> Result<FnDsaExpandedKey, FalconError>
Expand the private key into a precomputed signing tree.
The resulting FnDsaExpandedKey is ~1.5× faster per sign operation
at the cost of a one-time expansion (~2.5× a single sign).
Trait Implementations§
Source§impl Clone for FnDsaKeyPair
impl Clone for FnDsaKeyPair
Source§fn clone(&self) -> FnDsaKeyPair
fn clone(&self) -> FnDsaKeyPair
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more