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 new() -> Result<SecurityValidator, Error>
pub fn new() -> Result<SecurityValidator, Error>
Sourcepub fn validate_algorithm_category(
&self,
algorithm: Algorithm,
expected_category: AlgorithmCategory,
) -> Result<(), Error>
pub fn validate_algorithm_category( &self, algorithm: Algorithm, expected_category: AlgorithmCategory, ) -> Result<(), Error>
Sourcepub fn validate_key_size(
&self,
algorithm: Algorithm,
key_data: &[u8],
is_secret: bool,
) -> Result<(), Error>
pub fn validate_key_size( &self, algorithm: Algorithm, key_data: &[u8], is_secret: bool, ) -> Result<(), Error>
Sourcepub fn validate_public_key(
&self,
algorithm: Algorithm,
key_data: &[u8],
) -> Result<(), Error>
pub fn validate_public_key( &self, algorithm: Algorithm, key_data: &[u8], ) -> Result<(), Error>
Sourcepub fn validate_secret_key(
&self,
algorithm: Algorithm,
key_data: &[u8],
) -> Result<(), Error>
pub fn validate_secret_key( &self, algorithm: Algorithm, key_data: &[u8], ) -> Result<(), Error>
Sourcepub fn validate_aead_message(&self, message: &[u8]) -> Result<(), Error>
pub fn validate_aead_message(&self, message: &[u8]) -> Result<(), Error>
Validate AEAD plaintext, ciphertext, or associated data size for one operation.
Sourcepub fn validate_hash_input(&self, data: &[u8]) -> Result<(), Error>
pub fn validate_hash_input(&self, data: &[u8]) -> Result<(), Error>
Validate hash absorb input length.
Sourcepub fn validate_signature_message(&self, message: &[u8]) -> Result<(), Error>
pub fn validate_signature_message(&self, message: &[u8]) -> Result<(), Error>
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_ciphertext(
&self,
algorithm: Algorithm,
ciphertext: &[u8],
) -> Result<(), Error>
pub fn validate_ciphertext( &self, algorithm: Algorithm, ciphertext: &[u8], ) -> Result<(), Error>
Sourcepub fn validate_signature(
&self,
algorithm: Algorithm,
signature: &[u8],
) -> Result<(), Error>
pub fn validate_signature( &self, algorithm: Algorithm, signature: &[u8], ) -> Result<(), Error>
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 moreAuto Trait Implementations§
impl Freeze for SecurityValidator
impl RefUnwindSafe for SecurityValidator
impl Send for SecurityValidator
impl Sync for SecurityValidator
impl Unpin for SecurityValidator
impl UnsafeUnpin for SecurityValidator
impl UnwindSafe for SecurityValidator
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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