Struct openssl::derive::Deriver

source ·
pub struct Deriver<'a>(/* private fields */);
Expand description

A type used to derive a shared secret between two keys.

Implementations§

source§

impl<'a> Deriver<'a>

source

pub fn new<T>(key: &'a PKeyRef<T>) -> Result<Deriver<'a>, ErrorStack>
where T: HasPrivate,

Creates a new Deriver using the provided private key.

This corresponds to EVP_PKEY_derive_init.

source

pub fn set_peer<T>(&mut self, key: &'a PKeyRef<T>) -> Result<(), ErrorStack>
where T: HasPublic,

Sets the peer key used for secret derivation.

This corresponds to EVP_PKEY_derive_set_peer.

source

pub fn len(&mut self) -> Result<usize, ErrorStack>

Returns the size of the shared secret.

It can be used to size the buffer passed to Deriver::derive.

This corresponds to EVP_PKEY_derive.

source

pub fn derive(&mut self, buf: &mut [u8]) -> Result<usize, ErrorStack>

Derives a shared secret between the two keys, writing it into the buffer.

Returns the number of bytes written.

This corresponds to EVP_PKEY_derive.

source

pub fn derive_to_vec(&mut self) -> Result<Vec<u8>, ErrorStack>

A convenience function which derives a shared secret and returns it in a new buffer.

This simply wraps Deriver::len and Deriver::derive.

Trait Implementations§

source§

impl Drop for Deriver<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Deriver<'_>

source§

impl Sync for Deriver<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for Deriver<'a>

§

impl<'a> RefUnwindSafe for Deriver<'a>

§

impl<'a> Unpin for Deriver<'a>

§

impl<'a> UnwindSafe for Deriver<'a>

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>,

§

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>,

§

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.