rc_crypto::agreement

Struct PrivateKey

Source
pub struct PrivateKey<U: Lifetime> { /* private fields */ }
Expand description

A private key for key agreement.

Implementations§

Source§

impl<U: Lifetime> PrivateKey<U>

Source

pub fn algorithm(&self) -> &'static Algorithm

Source

pub fn compute_public_key(&self) -> Result<PublicKey>

Source

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>

Source

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.

Source

pub fn import(ec_key: &EcKey) -> Result<Self>

Source

pub fn export(&self) -> Result<EcKey>

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T