pub struct EphemeralKey { /* private fields */ }Expand description
An ephemeral X25519 keypair for forward secrecy
Used for a single key exchange and then discarded. Provides forward secrecy: if the long-term key is compromised, past sessions remain secure.
Implementations§
Source§impl EphemeralKey
impl EphemeralKey
Sourcepub fn public_key_bytes(&self) -> [u8; 32]
pub fn public_key_bytes(&self) -> [u8; 32]
Get the public key bytes (safe to share)
Sourcepub fn exchange(self, peer_public: &PublicKey) -> SharedSecret
pub fn exchange(self, peer_public: &PublicKey) -> SharedSecret
Perform X25519 key exchange (consumes the ephemeral secret)
Sourcepub fn exchange_with_bytes(self, peer_public_bytes: &[u8; 32]) -> SharedSecret
pub fn exchange_with_bytes(self, peer_public_bytes: &[u8; 32]) -> SharedSecret
Perform key exchange with peer’s public key bytes (consumes self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EphemeralKey
impl RefUnwindSafe for EphemeralKey
impl Send for EphemeralKey
impl Sync for EphemeralKey
impl Unpin for EphemeralKey
impl UnwindSafe for EphemeralKey
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