[][src]Struct exonum_crypto::Signature

pub struct Signature(_);

Ed25519 digital signature. This structure creates a signature over data using a secret key. Later it is possible to verify, using the corresponding public key, that the data have indeed been signed with that secret key.

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

Examples

The example below generates a pair of random public and secret keys, adds certain data, signs the data using the secret key and verifies that the data have been signed with that secret key.

let (public_key, secret_key) = exonum_crypto::gen_keypair();
let data = [1, 2, 3];
let signature = exonum_crypto::sign(&data, &secret_key);
assert!(exonum_crypto::verify(&signature, &data, &public_key));

Methods

impl Signature[src]

pub fn zero() -> Self[src]

Creates a new instance filled with zeros.

impl Signature[src]

pub fn new(bytes_array: [u8; 64]) -> 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; 64][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 Signature[src]

impl Clone for Signature[src]

impl Copy for Signature[src]

impl Debug for Signature[src]

impl Default for Signature[src]

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

impl Display for Signature[src]

impl Eq for Signature[src]

impl FromHex for Signature[src]

type Error = FromHexError

impl Hash for Signature[src]

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

type Output = [u8]

The returned type after indexing.

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

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for Signature[src]

type Output = [u8]

The returned type after indexing.

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

type Output = [u8]

The returned type after indexing.

impl Ord for Signature[src]

impl PartialEq<Signature> for Signature[src]

impl PartialOrd<Signature> for Signature[src]

impl ProtobufConvert for Signature[src]

type ProtoStruct = Signature

Type generated from the Protobuf definition.

impl Serialize for Signature[src]

impl StructuralEq for Signature[src]

impl StructuralPartialEq for Signature[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.