pub struct PrivateKey<U: Lifetime> { /* private fields */ }
Expand description
A private key for key agreement.
Implementations§
Source§impl<U: Lifetime> PrivateKey<U>
impl<U: Lifetime> PrivateKey<U>
pub fn algorithm(&self) -> &'static Algorithm
pub fn compute_public_key(&self) -> Result<PublicKey>
Sourcepub fn agree(
self,
peer_public_key: &UnparsedPublicKey<'_>,
) -> Result<InputKeyMaterial>
pub fn agree( self, peer_public_key: &UnparsedPublicKey<'_>, ) -> Result<InputKeyMaterial>
Ephemeral agreement.
This consumes self
, ensuring that the private key can
only be used for a single agreement operation.
Source§impl PrivateKey<Static>
impl PrivateKey<Static>
Sourcepub fn agree_static(
&self,
peer_public_key: &UnparsedPublicKey<'_>,
) -> Result<InputKeyMaterial>
pub fn agree_static( &self, peer_public_key: &UnparsedPublicKey<'_>, ) -> Result<InputKeyMaterial>
Static agreement.
This borrows self
, allowing the private key to
be used for a multiple agreement operations.
pub fn import(ec_key: &EcKey) -> Result<Self>
pub fn export(&self) -> Result<EcKey>
Sourcepub fn _tests_only_dangerously_convert_to_ephemeral(
self,
) -> PrivateKey<Ephemeral>
pub fn _tests_only_dangerously_convert_to_ephemeral( self, ) -> PrivateKey<Ephemeral>
The whole point of having Ephemeral
and Static
lifetimes is to use the type
system to avoid re-using the same ephemeral key. However for tests we might need
to create a “static” ephemeral key.
Auto Trait Implementations§
impl<U> Freeze for PrivateKey<U>
impl<U> RefUnwindSafe for PrivateKey<U>where
U: RefUnwindSafe,
impl<U> Send for PrivateKey<U>where
U: Send,
impl<U> !Sync for PrivateKey<U>
impl<U> Unpin for PrivateKey<U>where
U: Unpin,
impl<U> UnwindSafe for PrivateKey<U>where
U: UnwindSafe,
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