[][src]Struct ecdh_wrapper::PrivateKey

pub struct PrivateKey { /* fields omitted */ }

Privatekey, a keypair for performing ECDH and blinding operations.

Methods

impl PrivateKey
[src]

pub fn from_bytes(b: &[u8]) -> Result<PrivateKey, KeyError>
[src]

from_bytes creates a new keypair from the given bytes

pub fn from_pem_files(
    priv_file: String,
    pub_file: String
) -> Result<PrivateKey, KeyError>
[src]

Load private and public PEM files.

pub fn generate<R: Rng>(rng: &mut R) -> Result<PrivateKey, KeyError>
[src]

generate creates a new key pair

Arguments

  • rng - an implementation of Rng, a random number generator.

Returns

  • Returns a PrivateKey or an error.

pub fn load_bytes(&mut self, b: &[u8]) -> Result<(), KeyError>
[src]

load_bytes loads a key from the given bytes.

pub fn to_pem_files(
    &self,
    priv_file: String,
    pub_file: String
) -> Result<(), KeyError>
[src]

to_pem_files writes the public and privates keys to two PEM files.

pub fn regenerate<R: Rng>(&mut self, rng: &mut R) -> Result<(), KeyError>
[src]

regenerate uses the given rng to generate a new key.

pub fn public_key(&self) -> PublicKey
[src]

public_key returns the PublicKey

pub fn exp(&self, public_key: &PublicKey) -> [u8; 32]
[src]

Exp calculates the shared secret with the provided public key.

pub fn to_vec(&self) -> Vec<u8>
[src]

to_vec returns the private key as a Vec

pub fn as_array(self) -> [u8; 32]
[src]

as_array returns the private key as an array [u8; KEY_SIZE]

pub fn reset(&mut self)
[src]

reset resets the key to explicit zeros

Trait Implementations

impl Default for PrivateKey
[src]

impl PartialEq<PrivateKey> for PrivateKey
[src]

impl Clone for PrivateKey
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for PrivateKey
[src]

Auto Trait Implementations

impl Send for PrivateKey

impl Sync for PrivateKey

Blanket Implementations

impl<T> From for T
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self

impl<T> InitializableFromZeroed for T where
    T: Default
[src]