Skip to main content

MlDsa

Struct MlDsa 

Source
pub struct MlDsa<P: MlDsaSchemeParams + 'static> { /* private fields */ }
Expand description

ML-DSA signature scheme parameterized by a final FIPS 204 parameter set.

Implementations§

Source§

impl<P> MlDsa<P>
where P: MlDsaBackend + Send + Sync + 'static,

Source

pub fn sign_with_rng<R: CryptoRng + RngCore>( message: &[u8], secret_key: &MlDsaSecretKey, rng: &mut R, ) -> ApiResult<MlDsaSignature>

Generate a hedged FIPS 204 pure signature with an explicit caller RNG.

Source

pub fn sign_with_context_rng<R: CryptoRng + RngCore>( message: &[u8], context: &[u8], secret_key: &MlDsaSecretKey, rng: &mut R, ) -> ApiResult<MlDsaSignature>

Generate a hedged FIPS 204 pure signature with a context and caller RNG.

Source

pub fn sign_deterministic( message: &[u8], secret_key: &MlDsaSecretKey, ) -> ApiResult<MlDsaSignature>

Generate the optional deterministic FIPS 204 pure signature.

Source

pub fn sign_deterministic_with_context( message: &[u8], context: &[u8], secret_key: &MlDsaSecretKey, ) -> ApiResult<MlDsaSignature>

Generate the optional deterministic FIPS 204 pure signature with context.

Source

pub fn verify_with_context( message: &[u8], context: &[u8], signature: &MlDsaSignature, public_key: &MlDsaPublicKey, ) -> ApiResult<()>

Verify a pure FIPS 204 signature with an explicit context.

Trait Implementations§

Source§

impl<P> Signature for MlDsa<P>
where P: MlDsaBackend + Send + Sync + 'static,

Source§

type PublicKey = MlDsaPublicKey

Public key type for this algorithm
Source§

type SecretKey = MlDsaSecretKey

Secret key type - must be zeroizable but not byte-accessible Read more
Source§

type SignatureData = MlDsaSignature

Signature data type
Source§

type KeyPair = (<MlDsa<P> as Signature>::PublicKey, <MlDsa<P> as Signature>::SecretKey)

Key pair type (typically a tuple of public and secret keys)
Source§

fn name() -> &'static str

Returns the name of this signature algorithm
Source§

fn keypair<R: CryptoRng + RngCore>(rng: &mut R) -> ApiResult<Self::KeyPair>

Generate a new key pair using the provided RNG Read more
Source§

fn public_key(keypair: &Self::KeyPair) -> Self::PublicKey

Extract the public key from a key pair
Source§

fn secret_key(keypair: &Self::KeyPair) -> Self::SecretKey

Extract the secret key from a key pair
Source§

fn sign( message: &[u8], secret_key: &Self::SecretKey, ) -> ApiResult<Self::SignatureData>

Sign a message with the given secret key Read more
Source§

fn verify( message: &[u8], signature: &Self::SignatureData, public_key: &Self::PublicKey, ) -> ApiResult<()>

Verify a signature against a message and public key Read more

Auto Trait Implementations§

§

impl<P> Freeze for MlDsa<P>

§

impl<P> RefUnwindSafe for MlDsa<P>
where P: RefUnwindSafe,

§

impl<P> Send for MlDsa<P>

§

impl<P> Sync for MlDsa<P>

§

impl<P> Unpin for MlDsa<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for MlDsa<P>

§

impl<P> UnwindSafe for MlDsa<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.