Struct openssl::derive::Deriver[][src]

pub struct Deriver<'a>(_, _);

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

Implementations

impl<'a> Deriver<'a>[src]

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

Creates a new Deriver using the provided private key.

This corresponds to EVP_PKEY_derive_init.

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

Sets the peer key used for secret derivation.

This corresponds to EVP_PKEY_derive_set_peer:

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

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.

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

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.

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

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

impl<'a> Send for Deriver<'a>[src]

impl<'a> Sync for Deriver<'a>[src]

Auto Trait Implementations

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

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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.