VRF

Struct VRF 

Source
pub struct VRF { /* private fields */ }

Implementations§

Source§

impl VRF

Source

pub fn from_suite(suite: VRFCipherSuite) -> Result<Self, Error>

Associated function to initialize a VRF structure with an initialized context for the given cipher suite.

§Arguments:
  • suite: Identifying ciphersuite
§Returns:
  • a VRF struct if successful
Source

pub fn rsasp1( &mut self, secret_key: &Rsa<Private>, message: &BigNum, ) -> Result<BigNum, Error>

RSASP1 signature primitive defined in Section 5.2.1 of [RFC8017]

§Arguments:
  • secret_key: Rsa private key
  • message: BigNum message representation
§Returns:
  • a signature representative
Source

pub fn rsavp1( &mut self, public_key: &Rsa<Public>, signature: &BigNum, ) -> Result<BigNum, Error>

RSAVP1 verification primitive defined in Section 5.2.2 of [RFC8017]

§Arguments:
  • public_key: Rsa public key
  • signature: signed message to extract
§Returns:
  • a BigNum representing the message extracted from the signature
Source

pub fn mgf1( &mut self, mgf_seed: &[u8], mask_len: usize, ) -> Result<Vec<u8>, Error>

MGF1 mask generation function based on the hash function hash as defined in Section B.2.1 of [RFC8017]

§Arguments:
  • mgf_seed: seed from which mask is generated, an octet string
  • mask_len: intended length in octets of the mask; max length 2 ^ 32
§Returns:
  • an octet string of length mask_len

Trait Implementations§

Source§

impl VRF for VRF

Source§

fn prove( &mut self, secret_key: &Rsa<Private>, alpha_string: &[u8], ) -> Result<Vec<u8>, Error>

RSA-FDH-VRF prooving algorithm as defined in Section 4.1 of VRF-draft-05

§Arguments:
  • secret_key: RSA private key
  • alpha_string: VRF hash input, an octet string
§Returns:
  • pi_string: proof, an octet string of length k
Source§

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

RSA-FDH-VRF proof to hash algorithm as defined in Section 4.2 of VRF-draft-05

§Arguments:
  • pi_string: proof, an octet string of length k
§Returns:
  • beta_string: VRF hash output, an octet string of length hLen
Source§

fn verify( &mut self, public_key: &Rsa<Public>, alpha_string: &[u8], pi_string: &[u8], ) -> Result<Vec<u8>, Error>

RSA-FDH-VRF verifying algorithm as defined in Section 4.3 of VRF-draft-05

§Arguments:
  • public_key: RSA public key
  • alpha_string: VRF hash input, an octet string
  • pi_string: proof to be verified, an octet string of length n
§Returns:
  • beta_string: VRF hash output, an octet string of length hLen
Source§

type Error = Error

Auto Trait Implementations§

§

impl Freeze for VRF

§

impl RefUnwindSafe for VRF

§

impl Send for VRF

§

impl Sync for VRF

§

impl Unpin for VRF

§

impl UnwindSafe for VRF

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.