#[non_exhaustive]pub struct VerificationError;Expand description
Verification failed.
Returned when cryptographic verification fails (MAC tags, AEAD tags, signatures). Intentionally opaque to prevent timing side-channels.
§Examples
use rscrypto::traits::{VerificationError, ct::constant_time_eq};
fn verify(computed: &[u8; 32], expected: &[u8; 32]) -> Result<(), VerificationError> {
if constant_time_eq(computed, expected) {
Ok(())
} else {
Err(VerificationError::new())
}
}
let a = [0u8; 32];
let b = [1u8; 32];
assert!(verify(&a, &b).is_err());§Security
This error provides no details about the failure to prevent timing side-channels. Treat it as a generic authentication failure and avoid mapping it to finer-grained protocol responses that would recreate an oracle. The underlying verification should use constant-time comparison.
Implementations§
Trait Implementations§
Source§impl Clone for VerificationError
impl Clone for VerificationError
Source§fn clone(&self) -> VerificationError
fn clone(&self) -> VerificationError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VerificationError
impl Debug for VerificationError
Source§impl Default for VerificationError
impl Default for VerificationError
Source§impl Display for VerificationError
impl Display for VerificationError
Source§impl Error for VerificationError
impl Error for VerificationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<VerificationError> for OpenError
Available on crate features aes-gcm or aes-gcm-siv or chacha20poly1305 or xchacha20poly1305 or aegis256 or ascon-aead only.
impl From<VerificationError> for OpenError
Available on crate features
aes-gcm or aes-gcm-siv or chacha20poly1305 or xchacha20poly1305 or aegis256 or ascon-aead only.Source§fn from(value: VerificationError) -> Self
fn from(value: VerificationError) -> Self
Converts to this type from the input type.
Source§impl Hash for VerificationError
impl Hash for VerificationError
Source§impl PartialEq for VerificationError
impl PartialEq for VerificationError
impl Copy for VerificationError
impl Eq for VerificationError
impl StructuralPartialEq for VerificationError
Auto Trait Implementations§
impl Freeze for VerificationError
impl RefUnwindSafe for VerificationError
impl Send for VerificationError
impl Sync for VerificationError
impl Unpin for VerificationError
impl UnsafeUnpin for VerificationError
impl UnwindSafe for VerificationError
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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