[][src]Struct exonum_crypto::PublicKey

pub struct PublicKey(_);

Ed25519 public key used to verify digital signatures.

In public-key cryptography, the system uses a a mathematically related pair of keys: a public key, which is openly distributed, and a secret key, which should remain confidential. For more information, refer to Public-key cryptography.

Ed25519 is a signature system that ensures fast signing and key generation, as well as security and collision resilience.

Examples

In the example below, the function generates a pair of random public and secret keys.

let (public_key, _) = exonum_crypto::gen_keypair();

Methods

impl PublicKey[src]

pub fn zero() -> Self[src]

Creates a new instance filled with zeros.

impl PublicKey[src]

pub fn new(bytes_array: [u8; 32]) -> Self[src]

Creates a new instance from bytes array.

pub fn from_slice(bytes_slice: &[u8]) -> Option<Self>[src]

Creates a new instance from bytes slice.

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

Copies bytes from this instance.

pub fn to_hex(&self) -> String[src]

Returns a hex representation of binary data. Lower case letters are used (e.g. f9b4ca).

Trait Implementations

impl AsRef<[u8]> for PublicKey[src]

impl Clone for PublicKey[src]

impl Copy for PublicKey[src]

impl Debug for PublicKey[src]

impl Default for PublicKey[src]

impl<'de> Deserialize<'de> for PublicKey[src]

impl Display for PublicKey[src]

impl Eq for PublicKey[src]

impl FromHex for PublicKey[src]

type Error = FromHexError

impl Hash for PublicKey[src]

impl Index<Range<usize>> for PublicKey[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFrom<usize>> for PublicKey[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for PublicKey[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeTo<usize>> for PublicKey[src]

type Output = [u8]

The returned type after indexing.

impl Ord for PublicKey[src]

impl PartialEq<PublicKey> for PublicKey[src]

impl PartialOrd<PublicKey> for PublicKey[src]

impl ProtobufConvert for PublicKey[src]

type ProtoStruct = PublicKey

Type generated from the Protobuf definition.

impl Serialize for PublicKey[src]

impl StructuralEq for PublicKey[src]

impl StructuralPartialEq for PublicKey[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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

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

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

impl<T> ToHex for T where
    T: AsRef<[u8]>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.