pub trait SignatureOperations {
// Required methods
fn generate_keypair(
&self,
algorithm: Algorithm,
randomness: Option<&[u8]>,
) -> Result<SigKeypair>;
fn sign(
&self,
algorithm: Algorithm,
secret_key: &SigSecretKey,
message: &[u8],
randomness: Option<&[u8]>,
) -> Result<Vec<u8>>;
fn verify(
&self,
algorithm: Algorithm,
public_key: &SigPublicKey,
message: &[u8],
signature: &[u8],
) -> Result<bool>;
// Provided methods
fn sign_with_context(
&self,
algorithm: Algorithm,
secret_key: &SigSecretKey,
message: &[u8],
context: &[u8],
randomness: Option<&[u8]>,
) -> Result<Vec<u8>> { ... }
fn verify_with_context(
&self,
algorithm: Algorithm,
public_key: &SigPublicKey,
message: &[u8],
context: &[u8],
signature: &[u8],
) -> Result<bool> { ... }
}Expand description
Digital Signature operations
Required Methods§
fn generate_keypair( &self, algorithm: Algorithm, randomness: Option<&[u8]>, ) -> Result<SigKeypair>
fn sign( &self, algorithm: Algorithm, secret_key: &SigSecretKey, message: &[u8], randomness: Option<&[u8]>, ) -> Result<Vec<u8>>
fn verify( &self, algorithm: Algorithm, public_key: &SigPublicKey, message: &[u8], signature: &[u8], ) -> Result<bool>
Provided Methods§
Sourcefn sign_with_context(
&self,
algorithm: Algorithm,
secret_key: &SigSecretKey,
message: &[u8],
context: &[u8],
randomness: Option<&[u8]>,
) -> Result<Vec<u8>>
fn sign_with_context( &self, algorithm: Algorithm, secret_key: &SigSecretKey, message: &[u8], context: &[u8], randomness: Option<&[u8]>, ) -> Result<Vec<u8>>
Sign under a signing context (FIPS-204 / FIPS-205 domain separation).
The default implementation forwards an empty context to Self::sign and rejects any
non-empty context, so a provider that has not opted in cannot silently drop the context
and produce a signature that is not bound to it.
Sourcefn verify_with_context(
&self,
algorithm: Algorithm,
public_key: &SigPublicKey,
message: &[u8],
context: &[u8],
signature: &[u8],
) -> Result<bool>
fn verify_with_context( &self, algorithm: Algorithm, public_key: &SigPublicKey, message: &[u8], context: &[u8], signature: &[u8], ) -> Result<bool>
Verify under a signing context (FIPS-204 / FIPS-205 domain separation).
The default implementation forwards an empty context to Self::verify and rejects any
non-empty context, so a provider that has not opted in cannot silently ignore the
context and report a context-bound signature as valid.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl SignatureOperations for LibQSignatureProvider
Available on crate feature
alloc only.