pub struct SessionKeys {
pub initiator_key: SessionKey,
pub responder_key: SessionKey,
pub handshake_hash: [u8; 32],
pub rekey_auth_key: [u8; 32],
}Available on crate feature
crypto only.Expand description
Session keys derived from the Noise handshake.
Per 1-SECURITY.md:
(initiator_key, responder_key) = HKDF-Expand(
handshake_hash,
"nomad v1 session keys",
64
)Additionally, for PCS (Post-Compromise Security), we derive:
rekey_auth_key = HKDF-Expand(
static_dh_secret, // DH(s_initiator, S_responder)
"nomad v1 rekey auth",
32
)Fields§
§initiator_key: SessionKeyKey for initiator → responder messages
responder_key: SessionKeyKey for responder → initiator messages
handshake_hash: [u8; 32]The handshake hash (stored for rekeying)
rekey_auth_key: [u8; 32]Rekey authentication key for PCS (derived from static DH)
Implementations§
Source§impl SessionKeys
impl SessionKeys
Sourcepub fn derive(
result: &HandshakeResult,
static_dh_secret: &[u8; 32],
) -> Result<Self, CryptoError>
pub fn derive( result: &HandshakeResult, static_dh_secret: &[u8; 32], ) -> Result<Self, CryptoError>
Derive session keys from the handshake result and static DH secret.
Uses SHA-256 HKDF-Expand with the handshake hash as PRK for session keys, and the static DH secret for the rekey authentication key (PCS).
§Arguments
result- The handshake result containing the handshake hashstatic_dh_secret- The DH(s_initiator, S_responder) shared secret
Source§impl SessionKeys
impl SessionKeys
Sourcepub fn send_key(&self, role: Role) -> &SessionKey
pub fn send_key(&self, role: Role) -> &SessionKey
Get the send key for the given role.
Sourcepub fn recv_key(&self, role: Role) -> &SessionKey
pub fn recv_key(&self, role: Role) -> &SessionKey
Get the receive key for the given role.
Auto Trait Implementations§
impl Freeze for SessionKeys
impl RefUnwindSafe for SessionKeys
impl Send for SessionKeys
impl Sync for SessionKeys
impl Unpin for SessionKeys
impl UnwindSafe for SessionKeys
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