# 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]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

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

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

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

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

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

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

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

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `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.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `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.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.