pub struct SigningKey<P: MlDsaParams> { /* private fields */ }Expand description
ML-DSA signing key (i.e. private/secret key).
This type is initialized through a Seed, and can be used to generate ML-DSA signatures.
Implementations§
Source§impl<P: MlDsaParams> SigningKey<P>
impl<P: MlDsaParams> SigningKey<P>
Sourcepub fn from_seed(xi: &Seed) -> Self
pub fn from_seed(xi: &Seed) -> Self
Deterministically generate a signing key pair from the specified Seed.
This method reflects the ML-DSA.KeyGen_internal algorithm from FIPS 204 (Algorithm 6).
Sourcepub fn as_seed(&self) -> &Seed
pub fn as_seed(&self) -> &Seed
Borrow the Seed value: 32-bytes which can be used to reconstruct the SigningKey.
This value is key material. Please treat it with care.
Sourcepub fn to_seed(&self) -> Seed
pub fn to_seed(&self) -> Seed
Serialize the Seed value: 32-bytes which can be used to reconstruct the SigningKey.
This value is key material. Please treat it with care.
Trait Implementations§
Source§impl<P: MlDsaParams> AsRef<VerifyingKey<P>> for SigningKey<P>
Available on crate feature alloc only.
impl<P: MlDsaParams> AsRef<VerifyingKey<P>> for SigningKey<P>
alloc only.Source§fn as_ref(&self) -> &VerifyingKey<P>
fn as_ref(&self) -> &VerifyingKey<P>
Source§impl<P: Clone + MlDsaParams> Clone for SigningKey<P>
impl<P: Clone + MlDsaParams> Clone for SigningKey<P>
Source§fn clone(&self) -> SigningKey<P>
fn clone(&self) -> SigningKey<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<P: MlDsaParams> CtEq for SigningKey<P>
impl<P: MlDsaParams> CtEq for SigningKey<P>
Source§impl<P: MlDsaParams> Debug for SigningKey<P>
impl<P: MlDsaParams> Debug for SigningKey<P>
Source§impl<P: MlDsaParams> DigestSigner<Shake<136>, Signature<P>> for SigningKey<P>
The DigestSigner implementation for SigningKey uses the optional deterministic variant of ML-DSA
with a pre-computed μ, and only supports signing with an empty context string.
impl<P: MlDsaParams> DigestSigner<Shake<136>, Signature<P>> for SigningKey<P>
The DigestSigner implementation for SigningKey uses the optional deterministic variant of ML-DSA
with a pre-computed μ, and only supports signing with an empty context string.
Source§impl<P: MlDsaParams> Drop for SigningKey<P>
impl<P: MlDsaParams> Drop for SigningKey<P>
Source§impl<P> EncodePrivateKey for SigningKey<P>
Available on crate features pkcs8 and alloc only.
impl<P> EncodePrivateKey for SigningKey<P>
pkcs8 and alloc only.Source§fn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
SecretDocument containing a PKCS#8-encoded private key. Read moreSource§impl<P: MlDsaParams> Generate for SigningKey<P>
Available on crate feature rand_core only.Algorithm 1: ML-DSA.KeyGen().
impl<P: MlDsaParams> Generate for SigningKey<P>
rand_core only.Algorithm 1: ML-DSA.KeyGen().
Source§fn try_generate_from_rng<R: TryCryptoRng + ?Sized>(
rng: &mut R,
) -> Result<Self, R::Error>
fn try_generate_from_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Self, R::Error>
TryCryptoRng. Read moreSource§fn generate_from_rng<R>(rng: &mut R) -> Self
fn generate_from_rng<R>(rng: &mut R) -> Self
CryptoRng.Source§impl<P: MlDsaParams> KeyExport for SigningKey<P>
impl<P: MlDsaParams> KeyExport for SigningKey<P>
Source§impl<P: MlDsaParams> KeyInit for SigningKey<P>
impl<P: MlDsaParams> KeyInit for SigningKey<P>
Source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Source§impl<P: MlDsaParams> KeySizeUser for SigningKey<P>
impl<P: MlDsaParams> KeySizeUser for SigningKey<P>
Source§impl<P: MlDsaParams> KeypairRef for SigningKey<P>
Available on crate feature alloc only.
impl<P: MlDsaParams> KeypairRef for SigningKey<P>
alloc only.Source§type VerifyingKey = VerifyingKey<P>
type VerifyingKey = VerifyingKey<P>
Source§impl<P: MlDsaParams> MultipartSigner<Signature<P>> for SigningKey<P>
The Signer implementation for SigningKey uses the optional deterministic variant of ML-DSA, and
only supports signing with an empty context string.
impl<P: MlDsaParams> MultipartSigner<Signature<P>> for SigningKey<P>
The Signer implementation for SigningKey uses the optional deterministic variant of ML-DSA, and
only supports signing with an empty context string.
Source§fn try_multipart_sign(&self, msg: &[&[u8]]) -> Result<Signature<P>, Error>
fn try_multipart_sign(&self, msg: &[&[u8]]) -> Result<Signature<P>, Error>
Signer::try_sign() but the message is provided in non-contiguous byte
slices. Read moreSource§fn multipart_sign(&self, msg: &[&[u8]]) -> S
fn multipart_sign(&self, msg: &[&[u8]]) -> S
Signer::sign() but the message is provided in non-contiguous byte slices.Source§impl<P: MlDsaParams> PartialEq for SigningKey<P>
impl<P: MlDsaParams> PartialEq for SigningKey<P>
Source§impl<P> SignatureAlgorithmIdentifier for SigningKey<P>
Available on crate feature pkcs8 only.
impl<P> SignatureAlgorithmIdentifier for SigningKey<P>
pkcs8 only.Source§const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<P>::ALGORITHM_IDENTIFIER
const SIGNATURE_ALGORITHM_IDENTIFIER: AlgorithmIdentifier<Self::Params> = Signature<P>::ALGORITHM_IDENTIFIER
AlgorithmIdentifier for the corresponding signature system.Source§impl<P: MlDsaParams> Signer<Signature<P>> for SigningKey<P>
The Signer implementation for SigningKey uses the optional deterministic variant of ML-DSA, and
only supports signing with an empty context string.
impl<P: MlDsaParams> Signer<Signature<P>> for SigningKey<P>
The Signer implementation for SigningKey uses the optional deterministic variant of ML-DSA, and
only supports signing with an empty context string.
Source§impl<P> TryFrom<PrivateKeyInfo<AnyRef<'_>, &OctetStringRef, BitStringRef<'_>>> for SigningKey<P>
Available on crate feature pkcs8 only.
impl<P> TryFrom<PrivateKeyInfo<AnyRef<'_>, &OctetStringRef, BitStringRef<'_>>> for SigningKey<P>
pkcs8 only.impl<P: MlDsaParams> ZeroizeOnDrop for SigningKey<P>
zeroize only.Auto Trait Implementations§
impl<P> Freeze for SigningKey<P>where
<<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: Freeze,
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: Freeze,
<<P as ParameterSet>::L as ArraySize>::ArrayType<NttPolynomial<BaseField>>: Freeze,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: Freeze,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: Freeze,
impl<P> RefUnwindSafe for SigningKey<P>where
<<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: RefUnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: RefUnwindSafe,
<<P as ParameterSet>::L as ArraySize>::ArrayType<NttPolynomial<BaseField>>: RefUnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: RefUnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: RefUnwindSafe,
impl<P> Send for SigningKey<P>
impl<P> Sync for SigningKey<P>
impl<P> Unpin for SigningKey<P>where
<<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: Unpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: Unpin,
<<P as ParameterSet>::L as ArraySize>::ArrayType<NttPolynomial<BaseField>>: Unpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: Unpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: Unpin,
impl<P> UnsafeUnpin for SigningKey<P>where
<<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: UnsafeUnpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: UnsafeUnpin,
<<P as ParameterSet>::L as ArraySize>::ArrayType<NttPolynomial<BaseField>>: UnsafeUnpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: UnsafeUnpin,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: UnsafeUnpin,
impl<P> UnwindSafe for SigningKey<P>where
<<P as ParameterSet>::L as ArraySize>::ArrayType<Polynomial<BaseField>>: UnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<Polynomial<BaseField>>: UnwindSafe,
<<P as ParameterSet>::L as ArraySize>::ArrayType<NttPolynomial<BaseField>>: UnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttPolynomial<BaseField>>: UnwindSafe,
<<P as ParameterSet>::K as ArraySize>::ArrayType<NttVector<BaseField, <P as ParameterSet>::L>>: UnwindSafe,
Blanket Implementations§
Source§impl<S, T> AsyncSigner<S> for Twhere
T: Signer<S>,
impl<S, T> AsyncSigner<S> for Twhere
T: Signer<S>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef, BitStringRef<'a>>, Error = Error>,
impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef, BitStringRef<'a>>, Error = Error>,
Source§impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
Source§fn signature_algorithm_identifier(
&self,
) -> Result<AlgorithmIdentifier<Any>, Error>
fn signature_algorithm_identifier( &self, ) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for the corresponding signature system. Read more