[][src]Struct ecies_ed25519::SecretKey

pub struct SecretKey(_);

Secret Key

Neither this secret key (nor it's corresponding PublicKey) should be used for signing or in any other protocol other than ECIES.

Methods

impl SecretKey[src]

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

Convert this secret key to a byte array.

pub fn as_bytes<'a>(&'a self) -> &'a [u8; 32][src]

View this secret key as a byte array.

pub fn from_bytes(bytes: &[u8]) -> Result<SecretKey, Error>[src]

Construct a SecretKey from a slice of bytes.

Example

use ecies_ed25519::SecretKey;
use ecies_ed25519::SECRET_KEY_LENGTH;
use ecies_ed25519::Error;

let secret_key_bytes: [u8; SECRET_KEY_LENGTH] = [
   157, 097, 177, 157, 239, 253, 090, 096,
   186, 132, 074, 244, 146, 236, 044, 196,
   068, 073, 197, 105, 123, 050, 105, 025,
   112, 059, 172, 003, 028, 174, 127, 096, ];

let secret_key: SecretKey = SecretKey::from_bytes(&secret_key_bytes)?;

pub fn generate<T>(csprng: &mut T) -> SecretKey where
    T: CryptoRng + RngCore
[src]

Generate a SecretKey from a csprng.

Trait Implementations

impl Debug for SecretKey[src]

impl Drop for SecretKey[src]

Zero a secretKey when it's dropped

impl FromHex for SecretKey[src]

type Error = Error

impl ToHex for SecretKey[src]

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,