[][src]Trait tari_crypto::keys::PublicKey

pub trait PublicKey: ByteArray + Add<Output = Self> + Clone + PartialOrd + Ord + Default + Serialize + DeserializeOwned {
    type K: SecretKey;
    fn from_secret_key(k: &Self::K) -> Self;
fn key_length() -> usize;
fn batch_mul(scalars: &[Self::K], points: &[Self]) -> Self; fn random_keypair<R: Rng + CryptoRng>(rng: &mut R) -> (Self::K, Self) { ... } }

A trait specifying common behaviour for representing PublicKeys. Specific elliptic curve implementations need to implement this trait for them to be used in Tari.

See SecretKey for an example.

Associated Types

type K: SecretKey

Loading content...

Required methods

fn from_secret_key(k: &Self::K) -> Self

Calculate the public key associated with the given secret key. This should not fail; if a failure does occur (implementation error?), the function will panic.

fn key_length() -> usize

fn batch_mul(scalars: &[Self::K], points: &[Self]) -> Self

Loading content...

Provided methods

fn random_keypair<R: Rng + CryptoRng>(rng: &mut R) -> (Self::K, Self)

Loading content...

Implementors

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

Loading content...