MlDsaOperations

Trait MlDsaOperations 

Source
pub trait MlDsaOperations: Send + Sync {
    // Required methods
    fn generate_keypair(
        &self,
    ) -> Result<(MlDsaPublicKey, MlDsaSecretKey), PqcError>;
    fn sign(
        &self,
        secret_key: &MlDsaSecretKey,
        message: &[u8],
    ) -> Result<MlDsaSignature, PqcError>;
    fn verify(
        &self,
        public_key: &MlDsaPublicKey,
        message: &[u8],
        signature: &MlDsaSignature,
    ) -> Result<bool, PqcError>;
}
Expand description

ML-DSA operations trait

Required Methods§

Source

fn generate_keypair(&self) -> Result<(MlDsaPublicKey, MlDsaSecretKey), PqcError>

Generate a new ML-DSA keypair

§Errors

Returns an error if:

  • Random number generation fails
  • Key generation algorithm fails
  • Insufficient entropy is available
Source

fn sign( &self, secret_key: &MlDsaSecretKey, message: &[u8], ) -> Result<MlDsaSignature, PqcError>

Sign a message

§Errors

Returns an error if:

  • The secret key is invalid or malformed
  • Random number generation fails (for randomized signing)
  • The signing algorithm fails
  • The message is too large
Source

fn verify( &self, public_key: &MlDsaPublicKey, message: &[u8], signature: &MlDsaSignature, ) -> Result<bool, PqcError>

Verify a signature

§Errors

Returns an error if:

  • The public key is invalid or malformed
  • The signature is invalid or malformed
  • The verification algorithm fails
  • Internal computation errors occur

Implementors§