[][src]Struct tari_crypto::ristretto::ristretto_keys::RistrettoPublicKey

pub struct RistrettoPublicKey { /* fields omitted */ }

The PublicKey implementation for ristretto255 is a thin wrapper around the dalek library's RistrettoPoint.

Creating public keys

Both PublicKey and ByteArray are implemented on RistrettoPublicKey so all of the following will work:

This code runs with edition 2018
use tari_crypto::ristretto::{ RistrettoPublicKey, RistrettoSecretKey };
use tari_utilities::{ ByteArray, hex::Hex };
use tari_crypto::keys::{ PublicKey, SecretKey };
use rand;

let mut rng = rand::thread_rng();
let _p1 = RistrettoPublicKey::from_bytes(&[224, 196, 24, 247, 200, 217, 196, 205, 215, 57, 91, 147, 234, 18, 79, 58, 217,
144, 33, 187, 104, 29, 252, 51, 2, 169, 217, 154, 46, 83, 230, 78]);
let _p2 = RistrettoPublicKey::from_hex(&"e882b131016b52c1d3337080187cf768423efccbb517bb495ab812c4160ff44e");
let sk = RistrettoSecretKey::random(&mut rng);
let _p3 = RistrettoPublicKey::from_secret_key(&sk);

Trait Implementations

impl<'a, 'b> Add<&'b RistrettoPublicKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the + operator.

impl<'b> Add<&'b RistrettoPublicKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the + operator.

impl<'a> Add<RistrettoPublicKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the + operator.

impl Add<RistrettoPublicKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the + operator.

impl ByteArray for RistrettoPublicKey[src]

fn from_bytes(bytes: &[u8]) -> Result<RistrettoPublicKey, ByteArrayError> where
    Self: Sized
[src]

Create a new RistrettoPublicKey instance form the given byte array. The constructor returns errors under the following circumstances:

  • The byte array is not exactly 32 bytes
  • The byte array does not represent a valid (compressed) point on the ristretto255 curve

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

Return the little-endian byte array representation of the compressed public key

impl Clone for RistrettoPublicKey[src]

impl Debug for RistrettoPublicKey[src]

impl Default for RistrettoPublicKey[src]

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

impl DiffieHellmanSharedSecret for RistrettoPublicKey[src]

type PK = RistrettoPublicKey

fn shared_secret(k: &<Self::PK as PublicKey>::K, pk: &Self::PK) -> Self::PK[src]

Generate a shared secret from one party's private key and another party's public key

impl Display for RistrettoPublicKey[src]

impl Eq for RistrettoPublicKey[src]

impl ExtendBytes for RistrettoPublicKey[src]

impl<'_> From<&'_ RistrettoPublicKey> for RistrettoPoint[src]

impl From<RistrettoPublicKey> for RistrettoPoint[src]

impl From<RistrettoPublicKey> for CompressedRistretto[src]

impl Hash for RistrettoPublicKey[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Require the implementation of the Hash trait for Hashmaps

impl Hashable for RistrettoPublicKey[src]

impl<'a, 'b> Mul<&'b RistrettoPublicKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'b> Mul<&'b RistrettoPublicKey> for RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b RistrettoSecretKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'b> Mul<&'b RistrettoSecretKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a> Mul<RistrettoPublicKey> for &'a RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl Mul<RistrettoPublicKey> for RistrettoSecretKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl<'a> Mul<RistrettoSecretKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl Mul<RistrettoSecretKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the * operator.

impl Ord for RistrettoPublicKey[src]

impl PartialEq<RistrettoPublicKey> for RistrettoPublicKey[src]

impl PartialOrd<RistrettoPublicKey> for RistrettoPublicKey[src]

impl PublicKey for RistrettoPublicKey[src]

type K = RistrettoSecretKey

fn from_secret_key(k: &Self::K) -> RistrettoPublicKey[src]

Generates a new Public key from the given secret key

impl Serialize for RistrettoPublicKey[src]

impl<'a, 'b> Sub<&'b RistrettoPublicKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the - operator.

impl<'b> Sub<&'b RistrettoPublicKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the - operator.

impl<'a> Sub<RistrettoPublicKey> for &'a RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the - operator.

impl Sub<RistrettoPublicKey> for RistrettoPublicKey[src]

type Output = RistrettoPublicKey

The resulting type after applying the - operator.

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, U> Cast<U> for T where
    U: FromCast<T>, 

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

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

impl<T> FromBits<T> for T

impl<T> FromCast<T> for T

impl<T> Hex for T where
    T: ByteArray
[src]

type T = T

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

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

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<T> MessageFormat for T where
    T: DeserializeOwned + Serialize
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

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