pub struct ExpandedSigningKey<P: MlDsaParams> { /* private fields */ }Expand description
An ML-DSA signing key
Implementations§
Source§impl<P: MlDsaParams> ExpandedSigningKey<P>
impl<P: MlDsaParams> ExpandedSigningKey<P>
Sourcepub fn from_seed(seed: &Seed) -> Self
pub fn from_seed(seed: &Seed) -> Self
Deterministically generate an expanded signing key from the specified seed.
This method reflects the ML-DSA.KeyGen_internal algorithm from FIPS 204, but only returns a signing key.
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: TryCryptoRng + ?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: TryCryptoRng + ?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_mu_randomized<R: TryCryptoRng + ?Sized>(
&self,
mu: &Array<u8, U64>,
rng: &mut R,
) -> Result<Signature<P>, Error>
Available on crate feature rand_core only.
pub fn sign_mu_randomized<R: TryCryptoRng + ?Sized>( &self, mu: &Array<u8, U64>, rng: &mut R, ) -> Result<Signature<P>, Error>
rand_core only.This method reflects the randomized ML-DSA.Sign algorithm with a pre-computed μ.
§Errors
This method can return an opaque error 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 sign_mu_deterministic(&self, mu: &Array<u8, U64>) -> Signature<P>
pub fn sign_mu_deterministic(&self, mu: &Array<u8, U64>) -> Signature<P>
This method reflects the optional deterministic variant of the ML-DSA.Sign algorithm with a pre-computed μ.
Sourcepub fn verifying_key(&self) -> VerifyingKey<P>
pub fn verifying_key(&self) -> VerifyingKey<P>
This auxiliary function derives a VerifyingKey from a bare
ExpandedSigningKey (even in the absence of the original seed).
This is a utility function that is useful when importing the private key from an external source which does not export the seed and does not provide the precomputed public key associated with the private key itself.
ExpandedSigningKey implements signature::Keypair: this inherent method is
retained for convenience, so it is available for callers even when the
signature::Keypair trait is out-of-scope.
Sourcepub fn from_expanded(enc: &ExpandedSigningKeyBytes<P>) -> Selfwhere
P: MlDsaParams,
👎Deprecated since 0.1.0: use ExpandedSigningKey::from_seed instead
pub fn from_expanded(enc: &ExpandedSigningKeyBytes<P>) -> Selfwhere
P: MlDsaParams,
use ExpandedSigningKey::from_seed instead
DEPRECATED: decode the key from an appropriately sized byte array.
Note that this form is deprecated in practice; prefer to use ExpandedSigningKey::from_seed.
This API does not validate expanded signing keys and can potentially panic if keys are malformed or maliciously generated.
To avoid panics, use ExpandedSigningKey::from_seed instead.
Sourcepub fn to_expanded(&self) -> ExpandedSigningKeyBytes<P>where
P: MlDsaParams,
👎Deprecated since 0.1.0: use SigningKey::to_seed instead
pub fn to_expanded(&self) -> ExpandedSigningKeyBytes<P>where
P: MlDsaParams,
use SigningKey::to_seed instead
DEPRECATED: encode the key in a fixed-size byte array.
Note that this form is deprecated in practice; prefer to use SigningKey::to_seed.
Trait Implementations§
Source§impl<P: Clone + MlDsaParams> Clone for ExpandedSigningKey<P>
impl<P: Clone + MlDsaParams> Clone for ExpandedSigningKey<P>
Source§fn clone(&self) -> ExpandedSigningKey<P>
fn clone(&self) -> ExpandedSigningKey<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 ExpandedSigningKey<P>
impl<P: MlDsaParams> CtEq for ExpandedSigningKey<P>
Source§impl<P: MlDsaParams> Debug for ExpandedSigningKey<P>
impl<P: MlDsaParams> Debug for ExpandedSigningKey<P>
Source§impl<P: MlDsaParams> DigestSigner<Shake<136>, Signature<P>> for ExpandedSigningKey<P>
The Signer implementation for ExpandedSigningKey uses the optional deterministic variant of ML-DSA
with a pre-computed µ, and only supports signing with an empty context string. If you would
like to include a context string, use the ExpandedSigningKey::sign_mu_deterministic method.
impl<P: MlDsaParams> DigestSigner<Shake<136>, Signature<P>> for ExpandedSigningKey<P>
The Signer implementation for ExpandedSigningKey uses the optional deterministic variant of ML-DSA
with a pre-computed µ, and only supports signing with an empty context string. If you would
like to include a context string, use the ExpandedSigningKey::sign_mu_deterministic method.
Source§impl<P: MlDsaParams> Drop for ExpandedSigningKey<P>
impl<P: MlDsaParams> Drop for ExpandedSigningKey<P>
Source§impl<P: MlDsaParams> Keypair for ExpandedSigningKey<P>
The signature::Keypair implementation for ExpandedSigningKey allows to derive a
VerifyingKey from a bare ExpandedSigningKey (even in the absence of the original seed).
impl<P: MlDsaParams> Keypair for ExpandedSigningKey<P>
The signature::Keypair implementation for ExpandedSigningKey allows to derive a
VerifyingKey from a bare ExpandedSigningKey (even in the absence of the original seed).
Source§fn verifying_key(&self) -> Self::VerifyingKey
fn verifying_key(&self) -> Self::VerifyingKey
This is a utility function that is useful when importing the private key from an external source which does not export the seed and does not provide the precomputed public key associated with the private key itself.
Source§type VerifyingKey = VerifyingKey<P>
type VerifyingKey = VerifyingKey<P>
Source§impl<P: MlDsaParams> MultipartSigner<Signature<P>> for ExpandedSigningKey<P>
The Signer implementation for ExpandedSigningKey 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 ExpandedSigningKey::sign_deterministic method.
impl<P: MlDsaParams> MultipartSigner<Signature<P>> for ExpandedSigningKey<P>
The Signer implementation for ExpandedSigningKey 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 ExpandedSigningKey::sign_deterministic method.
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 ExpandedSigningKey<P>
impl<P: MlDsaParams> PartialEq for ExpandedSigningKey<P>
Source§impl<P: MlDsaParams> RandomizedDigestSigner<Shake<136>, Signature<P>> for ExpandedSigningKey<P>
Available on crate feature rand_core only.The RandomizedSigner implementation for ExpandedSigningKey only supports signing with an empty
context string. If you would like to include a context string, use the
ExpandedSigningKey::sign_mu_randomized method.
impl<P: MlDsaParams> RandomizedDigestSigner<Shake<136>, Signature<P>> for ExpandedSigningKey<P>
rand_core only.The RandomizedSigner implementation for ExpandedSigningKey only supports signing with an empty
context string. If you would like to include a context string, use the
ExpandedSigningKey::sign_mu_randomized method.
Source§fn try_sign_digest_with_rng<R: TryCryptoRng + ?Sized, F: Fn(&mut Shake256) -> Result<(), Error>>(
&self,
rng: &mut R,
f: F,
) -> Result<Signature<P>, Error>
fn try_sign_digest_with_rng<R: TryCryptoRng + ?Sized, F: Fn(&mut Shake256) -> Result<(), Error>>( &self, rng: &mut R, f: F, ) -> Result<Signature<P>, Error>
Digest with it, returning a digital
signature on success, or an error if something went wrong. Read moreSource§impl<P: MlDsaParams> RandomizedMultipartSigner<Signature<P>> for ExpandedSigningKey<P>
Available on crate feature rand_core only.The RandomizedSigner implementation for ExpandedSigningKey only supports signing with an empty
context string. If you would like to include a context string, use the
ExpandedSigningKey::sign_randomized method.
impl<P: MlDsaParams> RandomizedMultipartSigner<Signature<P>> for ExpandedSigningKey<P>
rand_core only.The RandomizedSigner implementation for ExpandedSigningKey only supports signing with an empty
context string. If you would like to include a context string, use the
ExpandedSigningKey::sign_randomized method.
Source§fn try_multipart_sign_with_rng<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
msg: &[&[u8]],
) -> Result<Signature<P>, Error>
fn try_multipart_sign_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, msg: &[&[u8]], ) -> Result<Signature<P>, Error>
RandomizedSigner::try_sign_with_rng() but the message is provided in
non-contiguous byte slices. Read moreSource§fn multipart_sign_with_rng<R>(&self, rng: &mut R, msg: &[&[u8]]) -> S
fn multipart_sign_with_rng<R>(&self, rng: &mut R, msg: &[&[u8]]) -> S
RandomizedSigner::sign_with_rng() but the message is provided in
non-contiguous byte slices.Source§impl<P: MlDsaParams> RandomizedSigner<Signature<P>> for ExpandedSigningKey<P>
Available on crate feature rand_core only.The RandomizedSigner implementation for ExpandedSigningKey only supports signing with an empty
context string. If you would like to include a context string, use the
ExpandedSigningKey::sign_randomized method.
impl<P: MlDsaParams> RandomizedSigner<Signature<P>> for ExpandedSigningKey<P>
rand_core only.The RandomizedSigner implementation for ExpandedSigningKey only supports signing with an empty
context string. If you would like to include a context string, use the
ExpandedSigningKey::sign_randomized method.
Source§impl<P> SignatureAlgorithmIdentifier for ExpandedSigningKey<P>
Available on crate feature pkcs8 only.
impl<P> SignatureAlgorithmIdentifier for ExpandedSigningKey<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 ExpandedSigningKey<P>
The Signer implementation for ExpandedSigningKey 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 ExpandedSigningKey::sign_deterministic method.
impl<P: MlDsaParams> Signer<Signature<P>> for ExpandedSigningKey<P>
The Signer implementation for ExpandedSigningKey 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 ExpandedSigningKey::sign_deterministic method.
Source§impl<P> TryFrom<PrivateKeyInfo<AnyRef<'_>, &OctetStringRef, BitStringRef<'_>>> for ExpandedSigningKey<P>
Available on crate feature pkcs8 only.
impl<P> TryFrom<PrivateKeyInfo<AnyRef<'_>, &OctetStringRef, BitStringRef<'_>>> for ExpandedSigningKey<P>
pkcs8 only.impl<P: MlDsaParams> ZeroizeOnDrop for ExpandedSigningKey<P>
zeroize only.Auto Trait Implementations§
impl<P> Freeze for ExpandedSigningKey<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 ExpandedSigningKey<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 ExpandedSigningKey<P>
impl<P> Sync for ExpandedSigningKey<P>
impl<P> Unpin for ExpandedSigningKey<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 ExpandedSigningKey<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 ExpandedSigningKey<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> AsyncRandomizedSigner<S> for Twhere
T: RandomizedSigner<S>,
impl<S, T> AsyncRandomizedSigner<S> for Twhere
T: RandomizedSigner<S>,
Source§async fn try_sign_with_rng_async<R>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
async fn try_sign_with_rng_async<R>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
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