pub struct SecurityValidator { /* private fields */ }Expand description
Centralized security validator for lib-Q
This validator provides comprehensive security validation for all cryptographic operations, including algorithm validation, key validation, timing attack prevention, and entropy validation.
Implementations§
Source§impl SecurityValidator
impl SecurityValidator
Sourcepub fn validate_algorithm_category(
&self,
algorithm: Algorithm,
expected_category: AlgorithmCategory,
) -> Result<()>
pub fn validate_algorithm_category( &self, algorithm: Algorithm, expected_category: AlgorithmCategory, ) -> Result<()>
Sourcepub fn validate_key_size(
&self,
algorithm: Algorithm,
key_data: &[u8],
is_secret: bool,
) -> Result<()>
pub fn validate_key_size( &self, algorithm: Algorithm, key_data: &[u8], is_secret: bool, ) -> Result<()>
Sourcepub fn validate_key_material(&self, key_data: &[u8]) -> Result<()>
pub fn validate_key_material(&self, key_data: &[u8]) -> Result<()>
Sourcepub fn validate_aead_message(&self, message: &[u8]) -> Result<()>
pub fn validate_aead_message(&self, message: &[u8]) -> Result<()>
Validate AEAD plaintext, ciphertext, or associated data size for one operation.
Sourcepub fn validate_hash_input(&self, data: &[u8]) -> Result<()>
pub fn validate_hash_input(&self, data: &[u8]) -> Result<()>
Validate hash absorb input length.
Sourcepub fn validate_signature_message(&self, message: &[u8]) -> Result<()>
pub fn validate_signature_message(&self, message: &[u8]) -> Result<()>
Validate signature message preimage length (same policy as Self::validate_hash_input).
Sourcepub fn security_constants(&self) -> &SecurityConstants
pub fn security_constants(&self) -> &SecurityConstants
Immutable access to configured security constants.
Sourcepub fn security_constants_mut(&mut self) -> &mut SecurityConstants
pub fn security_constants_mut(&mut self) -> &mut SecurityConstants
Mutable access to security constants (message size ceilings, nonce size, …).
Sourcepub fn validate_nonce(&self, nonce: &[u8]) -> Result<()>
pub fn validate_nonce(&self, nonce: &[u8]) -> Result<()>
Sourcepub fn validate_randomness(&self, randomness: &[u8]) -> Result<()>
pub fn validate_randomness(&self, randomness: &[u8]) -> Result<()>
Sourcepub fn constant_time_compare(&self, a: &[u8], b: &[u8]) -> bool
pub fn constant_time_compare(&self, a: &[u8], b: &[u8]) -> bool
Sourcepub fn entropy_validator(&self) -> &EntropyValidator
pub fn entropy_validator(&self) -> &EntropyValidator
Get immutable access to the entropy validator
This method provides access to the entropy validator for configuration and inspection purposes.
Sourcepub fn entropy_validator_mut(&mut self) -> &mut EntropyValidator
pub fn entropy_validator_mut(&mut self) -> &mut EntropyValidator
Get mutable access to the entropy validator
This method provides mutable access to the entropy validator for configuration purposes. Use with caution in production environments.
§Security Warning
Disabling entropy validation reduces security. Only use this for testing scenarios with deterministic randomness.
Trait Implementations§
Source§impl Clone for SecurityValidator
impl Clone for SecurityValidator
Source§fn clone(&self) -> SecurityValidator
fn clone(&self) -> SecurityValidator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more