pub struct HmacAuth { /* private fields */ }Expand description
HMAC authentication key for tls-auth
Implementations§
Source§impl HmacAuth
impl HmacAuth
Sourcepub fn from_single_key(key: [u8; 32]) -> Self
pub fn from_single_key(key: [u8; 32]) -> Self
Create from a single key (same key for both directions)
Sourcepub fn from_ta_key(
ta_key: &[u8; 256],
is_server: bool,
key_direction: Option<u8>,
) -> Self
pub fn from_ta_key( ta_key: &[u8; 256], is_server: bool, key_direction: Option<u8>, ) -> Self
Create from OpenVPN ta.key format (2048-bit / 256 bytes)
OpenVPN ta.key contains 4 keys:
- Bytes 0-63: Client HMAC key (encrypt direction)
- Bytes 64-127: Server HMAC key (encrypt direction)
- Bytes 128-191: Client HMAC key (decrypt direction)
- Bytes 192-255: Server HMAC key (decrypt direction)
Sourcepub fn authenticate(&self, data: &[u8]) -> [u8; 32]
pub fn authenticate(&self, data: &[u8]) -> [u8; 32]
Compute HMAC for an outgoing packet
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HmacAuth
impl RefUnwindSafe for HmacAuth
impl Send for HmacAuth
impl Sync for HmacAuth
impl Unpin for HmacAuth
impl UnwindSafe for HmacAuth
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