[][src]Struct vrf::openssl::ECVRF

pub struct ECVRF { /* fields omitted */ }

An Elliptic Curve VRF

Methods

impl ECVRF[src]

pub fn from_suite(suite: CipherSuite) -> Result<Self, Error>[src]

Factory method for creating a ECVRF structure with a context that is initialized for the provided cipher suite.

Arguments

  • suite - A ciphersuite identifying the curve/algorithms.

Returns

  • If successful, the ECVRF structure.

pub fn derive_public_key(&mut self, secret_key: &[u8]) -> Result<Vec<u8>, Error>[src]

Function for deriving a public key given a secret key point. Returns a vector of octets with the corresponding public key.

Arguments

  • secret_key - A BigNum referencing the secret key.

Returns

  • If successful, a Vec<u8> representing the public key.

pub fn proof_to_hash(&mut self, pi: &[u8]) -> Result<Vec<u8>, Error>[src]

Computes the VRF hash output as result of the digest of a ciphersuite-dependent prefix concatenated with the gamma point (VRF-draft-05, section 5.2).

Arguments

  • pi - A slice representing the VRF proof in octets.

Returns

  • If successful, a vector of octets with the VRF hash output.

Trait Implementations

impl<'_, '_> VRF<&'_ [u8], &'_ [u8]> for ECVRF[src]

VRFs are objects capable of generating and verifying proofs.

type Error = Error

fn prove(&mut self, x: &[u8], alpha: &[u8]) -> Result<Vec<u8>, Error>[src]

Generates proof from a secret key and message as specified in the VRF-draft-05 (section 5.1).

Arguments

  • x - A slice representing the secret key in octets.
  • alpha - A slice representing the message in octets.

Returns

  • If successful, a vector of octets representing the proof of the VRF.

fn verify(
    &mut self,
    y: &[u8],
    pi: &[u8],
    alpha: &[u8]
) -> Result<Vec<u8>, Error>
[src]

Verifies the provided VRF proof and computes the VRF hash output as specified in VRF-draft-05 (section 5.3).

Arguments

  • y - A slice representing the public key in octets.
  • pi - A slice of octets representing the VRF proof.

Returns

  • If successful, a vector of octets with the VRF hash output.

impl Debug for ECVRF[src]

Auto Trait Implementations

impl Send for ECVRF

impl Sync for ECVRF

impl Unpin for ECVRF

impl UnwindSafe for ECVRF

impl RefUnwindSafe for ECVRF

Blanket Implementations

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

impl<T> From<T> for T[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<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]