pub struct SigningKey<P: MlDsaParams> { /* private fields */ }Expand description
An ML-DSA signing key
Implementations§
Source§impl<P: MlDsaParams> SigningKey<P>
impl<P: MlDsaParams> SigningKey<P>
Sourcepub fn sign_internal(&self, Mp: &[&[u8]], rnd: &B32) -> Signature<P>where
P: MlDsaParams,
pub fn sign_internal(&self, Mp: &[&[u8]], rnd: &B32) -> Signature<P>where
P: MlDsaParams,
This method reflects the ML-DSA.Sign_internal algorithm from FIPS 204. It does not include the domain separator that distinguishes between the normal and pre-hashed cases, and it does not separate the context string from the rest of the message.
Sourcepub fn sign_randomized<R: RngCore + CryptoRng + ?Sized>(
&self,
M: &[u8],
ctx: &[u8],
rng: &mut R,
) -> Result<Signature<P>, Error>
Available on crate feature rand_core only.
pub fn sign_randomized<R: RngCore + CryptoRng + ?Sized>( &self, M: &[u8], ctx: &[u8], rng: &mut R, ) -> Result<Signature<P>, Error>
rand_core only.This method reflects the randomized ML-DSA.Sign algorithm.
§Errors
This method will return an opaque error if the context string is more than 255 bytes long, or if it fails to get enough randomness.
Sourcepub fn sign_deterministic(
&self,
M: &[u8],
ctx: &[u8],
) -> Result<Signature<P>, Error>
pub fn sign_deterministic( &self, M: &[u8], ctx: &[u8], ) -> Result<Signature<P>, Error>
This method reflects the optional deterministic variant of the ML-DSA.Sign algorithm.
§Errors
This method will return an opaque error if the context string is more than 255 bytes long.
Sourcepub fn encode(&self) -> EncodedSigningKey<P>where
P: MlDsaParams,
pub fn encode(&self) -> EncodedSigningKey<P>where
P: MlDsaParams,
Encode the key in a fixed-size byte array.
Sourcepub fn decode(enc: &EncodedSigningKey<P>) -> Selfwhere
P: MlDsaParams,
pub fn decode(enc: &EncodedSigningKey<P>) -> Selfwhere
P: MlDsaParams,
Decode the key from an appropriately sized byte array.
Trait Implementations§
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<P: MlDsaParams> Debug for SigningKey<P>
impl<P: MlDsaParams> Debug for SigningKey<P>
Source§impl<P: PartialEq + MlDsaParams> PartialEq for SigningKey<P>
impl<P: PartialEq + MlDsaParams> PartialEq for SigningKey<P>
Source§impl<P: MlDsaParams> RandomizedSigner<Signature<P>> for SigningKey<P>
Available on crate feature rand_core only.The RandomizedSigner implementation for SigningKey only supports signing with an empty
context string. If you would like to include a context string, use the [SigningKey::sign]
method.
impl<P: MlDsaParams> RandomizedSigner<Signature<P>> for SigningKey<P>
rand_core only.The RandomizedSigner implementation for SigningKey only supports signing with an empty
context string. If you would like to include a context string, use the [SigningKey::sign]
method.
Source§fn try_sign_with_rng(
&self,
rng: &mut impl CryptoRngCore,
msg: &[u8],
) -> Result<Signature<P>, Error>
fn try_sign_with_rng( &self, rng: &mut impl CryptoRngCore, msg: &[u8], ) -> Result<Signature<P>, Error>
Source§fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
fn sign_with_rng(&self, rng: &mut impl CryptoRngCore, msg: &[u8]) -> S
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 singature 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. If you would like to include a context
string, use the SigningKey::sign_deterministic method.
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. If you would like to include a context
string, use the SigningKey::sign_deterministic method.
Source§impl<P> TryFrom<PrivateKeyInfo<'_>> for SigningKey<P>
Available on crate feature pkcs8 only.
impl<P> TryFrom<PrivateKeyInfo<'_>> for SigningKey<P>
pkcs8 only.impl<P: MlDsaParams> StructuralPartialEq for SigningKey<P>
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> 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<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 T
impl<T> DecodePrivateKey for T
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 singature system.