pub struct SecretKey(/* private fields */);Expand description
An X25519 private key: 32 bytes, little-endian.
Stored unclamped; clamping (RFC 7748) is applied by the driver as part of the X25519 function. Zeroed on drop.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Self
pub fn from_bytes(bytes: &[u8; 32]) -> Self
Load a private key.
Sourcepub fn public_key(&self) -> Result<PublicKey, Error>
pub fn public_key(&self) -> Result<PublicKey, Error>
The corresponding public key.
Sourcepub fn diffie_hellman(&self, peer: &PublicKey) -> Result<SharedSecret, Error>
pub fn diffie_hellman(&self, peer: &PublicKey) -> Result<SharedSecret, Error>
The shared secret with peer.
Fails with Error::InvalidKey if peer is a low-order point, which
makes the shared secret all zeros (RFC 7748 section 6.1, required by
TLS 1.3).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecretKey
impl RefUnwindSafe for SecretKey
impl Send for SecretKey
impl Sync for SecretKey
impl Unpin for SecretKey
impl UnsafeUnpin for SecretKey
impl UnwindSafe for SecretKey
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