pub struct DilithiumSecretKey { /* private fields */ }Expand description
ML-DSA expanded private key encoded with FIPS 204 Algorithm 24 (skEncode).
In particular, bytes 64..128 contain the complete 64-byte tr = H(pk, 64)
value. Bare bytes do not carry a format version, so use paired import or
external provenance/framing when distinguishing affected legacy objects.
Implementations§
Source§impl DilithiumSecretKey
impl DilithiumSecretKey
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, SignError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, SignError>
Decode a syntactically valid final-FIPS-204 expanded private key.
An expanded private-key encoding does not carry enough information for
this backend to derive and validate its public key without reintroducing
a second secret-arithmetic implementation. Use
Self::from_bytes_with_public_key when the corresponding public key is
available. A key decoded with this method can sign, but
Self::public_key returns an error instead of guessing or panicking.
Sourcepub fn from_bytes_with_public_key(
bytes: &[u8],
public_key: &DilithiumPublicKey,
) -> Result<Self, SignError>
pub fn from_bytes_with_public_key( bytes: &[u8], public_key: &DilithiumPublicKey, ) -> Result<Self, SignError>
Decode an expanded private key and validate it against its public key.
Besides the exact FIPS 204 encodings, this checks the stored 64-byte
tr, then performs a deterministic sign/verify coherence check through
the libcrux backend. This is the preferred import API.
Sourcepub fn public_key(&self) -> Result<DilithiumPublicKey, SignError>
pub fn public_key(&self) -> Result<DilithiumPublicKey, SignError>
Return the public key retained at generation or paired import time.
Trait Implementations§
Source§impl AsRef<[u8]> for DilithiumSecretKey
impl AsRef<[u8]> for DilithiumSecretKey
Source§impl Clone for DilithiumSecretKey
impl Clone for DilithiumSecretKey
Source§fn clone(&self) -> DilithiumSecretKey
fn clone(&self) -> DilithiumSecretKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DilithiumSecretKey
impl Debug for DilithiumSecretKey
Source§impl Drop for DilithiumSecretKey
impl Drop for DilithiumSecretKey
Auto Trait Implementations§
impl Freeze for DilithiumSecretKey
impl RefUnwindSafe for DilithiumSecretKey
impl Send for DilithiumSecretKey
impl Sync for DilithiumSecretKey
impl Unpin for DilithiumSecretKey
impl UnsafeUnpin for DilithiumSecretKey
impl UnwindSafe for DilithiumSecretKey
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConstantTimeEquals for T
impl<T> ConstantTimeEquals for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)