pub struct MlDsaSigner { /* private fields */ }Expand description
ML-DSA cryptographic signer
Implementations§
Source§impl MlDsaSigner
impl MlDsaSigner
Sourcepub fn generate_keypair() -> Result<(MlDsaPrivateKey, MlDsaPublicKey), MlDsaError>
pub fn generate_keypair() -> Result<(MlDsaPrivateKey, MlDsaPublicKey), MlDsaError>
Generate a new real ML-DSA-65 (FIPS-204) key pair.
Sourcepub fn from_keypair(
private_key: MlDsaPrivateKey,
public_key: MlDsaPublicKey,
) -> Self
pub fn from_keypair( private_key: MlDsaPrivateKey, public_key: MlDsaPublicKey, ) -> Self
Create signer from key pair
Sourcepub fn sign(
&self,
message: &[u8],
context: &CryptoContext,
) -> Result<MlDsaSignature, MlDsaError>
pub fn sign( &self, message: &[u8], context: &CryptoContext, ) -> Result<MlDsaSignature, MlDsaError>
Sign message with this signer’s ML-DSA-65 secret key.
The context fields are bound to the signature via the FIPS-204 context string
(derived deterministically by derive_ctx). Sign and verify must use an equal
CryptoContext.
Sourcepub fn verify(
&self,
message: &[u8],
signature: &MlDsaSignature,
context: &CryptoContext,
) -> Result<bool, MlDsaError>
pub fn verify( &self, message: &[u8], signature: &MlDsaSignature, context: &CryptoContext, ) -> Result<bool, MlDsaError>
Verify an ML-DSA-65 signature over message against this signer’s public key.
Sourcepub fn public_key(&self) -> &MlDsaPublicKey
pub fn public_key(&self) -> &MlDsaPublicKey
Get public key
Sourcepub fn set_key_id(&mut self, key_id: String)
pub fn set_key_id(&mut self, key_id: String)
Set key ID
Sourcepub fn sign_with_secret(
sk_bytes: &[u8],
message: &[u8],
context: &CryptoContext,
) -> Result<MlDsaSignature, MlDsaError>
pub fn sign_with_secret( sk_bytes: &[u8], message: &[u8], context: &CryptoContext, ) -> Result<MlDsaSignature, MlDsaError>
Sign message with a serialized ML-DSA-65 secret key (SK_LEN bytes).
Sourcepub fn verify_with_public(
pk_bytes: &[u8],
message: &[u8],
signature: &MlDsaSignature,
context: &CryptoContext,
) -> Result<bool, MlDsaError>
pub fn verify_with_public( pk_bytes: &[u8], message: &[u8], signature: &MlDsaSignature, context: &CryptoContext, ) -> Result<bool, MlDsaError>
Verify an ML-DSA-65 signature using a serialized public key (PK_LEN bytes).
Auto Trait Implementations§
impl Freeze for MlDsaSigner
impl RefUnwindSafe for MlDsaSigner
impl Send for MlDsaSigner
impl Sync for MlDsaSigner
impl Unpin for MlDsaSigner
impl UnsafeUnpin for MlDsaSigner
impl UnwindSafe for MlDsaSigner
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more