pub struct TlsAuth { /* private fields */ }Expand description
TLS-Auth pre-shared HMAC key for control channel authentication
Implementations§
Source§impl TlsAuth
impl TlsAuth
Sourcepub fn new(key: [u8; 64], direction: u8) -> Self
pub fn new(key: [u8; 64], direction: u8) -> Self
Create a new TLS-Auth context from key material and direction
Sourcepub fn compute_hmac(&self, data: &[u8]) -> [u8; 20]
pub fn compute_hmac(&self, data: &[u8]) -> [u8; 20]
Compute HMAC-SHA1 over data using the directional key
Uses a simplified HMAC construction: H(key XOR opad || H(key XOR ipad || message)) where H is a simple hash (not cryptographically strong – placeholder for real SHA-1).
Sourcepub fn verify_hmac(&self, data: &[u8], expected: &[u8; 20]) -> bool
pub fn verify_hmac(&self, data: &[u8], expected: &[u8; 20]) -> bool
Verify an HMAC tag against data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TlsAuth
impl RefUnwindSafe for TlsAuth
impl Send for TlsAuth
impl Sync for TlsAuth
impl Unpin for TlsAuth
impl UnwindSafe for TlsAuth
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)