pub struct VRF { /* private fields */ }Implementations
sourceimpl VRF
impl VRF
sourcepub fn from_suite(suite: VRFCipherSuite) -> Result<Self, Error>
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
sourcepub fn rsasp1(
&mut self,
secret_key: &Rsa<Private>,
message: &BigNum
) -> Result<BigNum, Error>
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 keymessage: BigNum message representation
Returns:
- a signature representative
sourcepub fn rsavp1(
&mut self,
public_key: &Rsa<Public>,
signature: &BigNum
) -> Result<BigNum, Error>
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 keysignature: signed message to extract
Returns:
- a BigNum representing the message extracted from the signature
sourcepub fn mgf1(&mut self, mgf_seed: &[u8], mask_len: usize) -> Result<Vec<u8>, Error>
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 stringmask_len: intended length in octets of the mask; max length 2 ^ 32
Returns:
- an octet string of length mask_len
Trait Implementations
sourceimpl VRF for VRF
impl VRF for VRF
sourcefn prove(
&mut self,
secret_key: &Rsa<Private>,
alpha_string: &[u8]
) -> Result<Vec<u8>, Error>
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 keyalpha_string: VRF hash input, an octet string
Returns:
pi_string: proof, an octet string of length k
sourcefn proof_to_hash(&mut self, pi_string: &[u8]) -> Result<Vec<u8>, Error>
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
sourcefn verify(
&mut self,
public_key: &Rsa<Public>,
alpha_string: &[u8],
pi_string: &[u8]
) -> Result<Vec<u8>, Error>
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 keyalpha_string: VRF hash input, an octet stringpi_string: proof to be verified, an octet string of length n
Returns:
beta_string: VRF hash output, an octet string of length hLen
type Error = Error
Auto Trait Implementations
impl RefUnwindSafe for VRF
impl Send for VRF
impl Sync for VRF
impl Unpin for VRF
impl UnwindSafe for VRF
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more