pub struct SecretKey(/* private fields */);Expand description
An ECDH private key: a nonzero scalar.
Served by the curve’s ECDH driver. Zeroed on drop.
Implementations§
Source§impl SecretKey
impl SecretKey
Sourcepub fn from_bytes(bytes: &[u8; 48]) -> Result<Self, Error>
pub fn from_bytes(bytes: &[u8; 48]) -> Result<Self, Error>
Load a private key from its big-endian encoding. Fails if it is
zero or not less than n.
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: the X coordinate of self * peer.
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