pub struct Spake2Output {
pub session_key: SharedSecret,
pub confirmation_mac: Vec<u8>,
/* private fields */
}Expand description
Output of a completed SPAKE2 protocol run.
Contains the session key and confirmation MACs.
Fields§
§session_key: SharedSecretThe session key (Ke, first half of the hash).
confirmation_mac: Vec<u8>This party’s confirmation MAC to send to the peer.
Implementations§
Source§impl Spake2Output
impl Spake2Output
Sourcepub fn verify_peer_confirmation(
&self,
peer_mac: &[u8],
) -> Result<(), Spake2Error>
pub fn verify_peer_confirmation( &self, peer_mac: &[u8], ) -> Result<(), Spake2Error>
Verify the peer’s confirmation MAC in constant time.
Sourcepub fn into_session_key(self) -> SharedSecret
pub fn into_session_key(self) -> SharedSecret
Consume the output and yield the session key.
Because Spake2Output derives ZeroizeOnDrop, it cannot be
pattern-destructured by the caller. This consumer extracts the
session key cleanly without the boilerplate mem::replace shim
users would otherwise have to write themselves.
Both pub fields remain accessible; clone the one you want to
keep before calling the consumer that takes the other:
ⓘ
output.verify_peer_confirmation(peer_mac)?;
let confirmation_mac = output.confirmation_mac.clone();
let session_key = output.into_session_key();Sourcepub fn into_confirmation_mac(self) -> Vec<u8> ⓘ
pub fn into_confirmation_mac(self) -> Vec<u8> ⓘ
Consume the output and yield this party’s confirmation MAC.
Mirror of Self::into_session_key.
Trait Implementations§
Source§impl Drop for Spake2Output
impl Drop for Spake2Output
Auto Trait Implementations§
impl Freeze for Spake2Output
impl RefUnwindSafe for Spake2Output
impl Send for Spake2Output
impl Sync for Spake2Output
impl Unpin for Spake2Output
impl UnsafeUnpin for Spake2Output
impl UnwindSafe for Spake2Output
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