pub struct Session<S> { /* private fields */ }Expand description
Secure-channel session state.
Implementations§
Source§impl Session<Disconnected>
impl Session<Disconnected>
Source§impl Session<Challenged>
impl Session<Challenged>
Sourcepub fn receive_ccrypt(
self,
ccrypt: &CCrypt,
) -> Result<Session<Cryptogrammed>, (Session<Disconnected>, SecureSessionError)>
pub fn receive_ccrypt( self, ccrypt: &CCrypt, ) -> Result<Session<Cryptogrammed>, (Session<Disconnected>, SecureSessionError)>
Verify the PD’s CCrypt and move to Cryptogrammed.
Source§impl Session<Cryptogrammed>
impl Session<Cryptogrammed>
Sourcepub fn server_cryptogram(&self) -> [u8; 16]
pub fn server_cryptogram(&self) -> [u8; 16]
Compute the server cryptogram to ship in osdp_SCRYPT.
Sourcepub fn initial_rmac(&self) -> [u8; 16]
pub fn initial_rmac(&self) -> [u8; 16]
Initial R-MAC, computed from S-MAC1/S-MAC2 over the server cryptogram.
Sourcepub fn confirm_rmac_i(
self,
their_rmac_i: &[u8; 16],
) -> Result<Session<Secure>, (Session<Disconnected>, SecureSessionError)>
pub fn confirm_rmac_i( self, their_rmac_i: &[u8; 16], ) -> Result<Session<Secure>, (Session<Disconnected>, SecureSessionError)>
PD echoed back our initial R-MAC; advance to fully Secure.
Source§impl Session<Secure>
impl Session<Secure>
Sourcepub fn mac(&mut self, bytes: &[u8]) -> [u8; 16]
pub fn mac(&mut self, bytes: &[u8]) -> [u8; 16]
Compute the MAC trailer for an outgoing packet body.
bytes is the SOM..end-of-DATA region (as per super::mac::cbc_mac).
Sourcepub fn verify(
&mut self,
bytes: &[u8],
wire_mac: &[u8; 4],
) -> Result<(), SecureSessionError>
pub fn verify( &mut self, bytes: &[u8], wire_mac: &[u8; 4], ) -> Result<(), SecureSessionError>
Verify a received MAC against our locally-computed value.
Sourcepub fn keys(&self) -> &SessionKeys
pub fn keys(&self) -> &SessionKeys
Borrow the derived session keys (for AES-CBC DATA encryption).
Sourcepub fn last_other_mac(&self) -> &[u8; 16]
pub fn last_other_mac(&self) -> &[u8; 16]
Last MAC the other end produced (used as encryption ICV per Annex D).
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Session<S>
impl<S> RefUnwindSafe for Session<S>where
S: RefUnwindSafe,
impl<S> Send for Session<S>where
S: Send,
impl<S> Sync for Session<S>where
S: Sync,
impl<S> Unpin for Session<S>where
S: Unpin,
impl<S> UnsafeUnpin for Session<S>
impl<S> UnwindSafe for Session<S>where
S: UnwindSafe,
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