pub struct VoprfServer<CS: CipherSuite> { /* private fields */ }Expand description
A server which engages with a VoprfClient in verifiable mode, meaning that the OPRF outputs can be checked against a server public key.
Implementations§
Source§impl<CS: CipherSuite> VoprfServer<CS>
impl<CS: CipherSuite> VoprfServer<CS>
Sourcepub fn serialize(&self) -> Array<u8, VoprfServerLen<CS>>
pub fn serialize(&self) -> Array<u8, VoprfServerLen<CS>>
Serialization into bytes
Sourcepub fn deserialize(input: &[u8]) -> Result<Self>
pub fn deserialize(input: &[u8]) -> Result<Self>
Source§impl<CS: CipherSuite> VoprfServer<CS>
impl<CS: CipherSuite> VoprfServer<CS>
Sourcepub fn new<R: TryRng + TryCryptoRng>(rng: &mut R) -> Result<Self>
pub fn new<R: TryRng + TryCryptoRng>(rng: &mut R) -> Result<Self>
Produces a new instance of a VoprfServer using a supplied RNG
§Errors
Error::Protocol if the protocol fails and can’t be completed.
Sourcepub fn new_with_key(key: &[u8]) -> Result<Self>
pub fn new_with_key(key: &[u8]) -> Result<Self>
Produces a new instance of a VoprfServer using a supplied set of bytes to represent the server’s private key
§Errors
Error::Deserialization if the private key is not a valid point on
the group or zero.
Sourcepub fn new_from_seed(seed: &[u8], info: &[u8]) -> Result<Self>
pub fn new_from_seed(seed: &[u8], info: &[u8]) -> Result<Self>
Produces a new instance of a VoprfServer using a supplied set of bytes which are used as a seed to derive the server’s private key.
Corresponds to DeriveKeyPair() function from the VOPRF specification.
§Errors
Error::DeriveKeyPairif theinputandseedtogether are longer thenu16::MAX - 3.Error::Protocolif the protocol fails and can’t be completed.
Sourcepub fn blind_evaluate<R: TryRng + TryCryptoRng>(
&self,
rng: &mut R,
blinded_element: &BlindedElement<CS>,
) -> VoprfServerEvaluateResult<CS>
pub fn blind_evaluate<R: TryRng + TryCryptoRng>( &self, rng: &mut R, blinded_element: &BlindedElement<CS>, ) -> VoprfServerEvaluateResult<CS>
Computes the second step for the multiplicative blinding version of DH-OPRF. This message is sent from the server (who holds the OPRF key) to the client.
Sourcepub fn batch_blind_evaluate<'a, R: TryRng + TryCryptoRng, I>(
&self,
rng: &mut R,
blinded_elements: &'a I,
) -> Result<VoprfServerBatchEvaluateResult<CS>>where
CS: 'a,
&'a I: IntoIterator<Item = &'a BlindedElement<CS>>,
<&'a I as IntoIterator>::IntoIter: ExactSizeIterator,
Available on crate feature alloc only.
pub fn batch_blind_evaluate<'a, R: TryRng + TryCryptoRng, I>(
&self,
rng: &mut R,
blinded_elements: &'a I,
) -> Result<VoprfServerBatchEvaluateResult<CS>>where
CS: 'a,
&'a I: IntoIterator<Item = &'a BlindedElement<CS>>,
<&'a I as IntoIterator>::IntoIter: ExactSizeIterator,
alloc only.Allows for batching of the evaluation of multiple BlindedElement messages from a VoprfClient
§Errors
Error::Batch if the number of blinded_elements and
evaluation_elements don’t match or is longer then u16::MAX
Sourcepub fn batch_blind_evaluate_prepare<'a, I: Iterator<Item = &'a BlindedElement<CS>>>(
&self,
blinded_elements: I,
) -> VoprfServerBatchEvaluatePreparedEvaluationElements<CS, I>where
CS: 'a,
pub fn batch_blind_evaluate_prepare<'a, I: Iterator<Item = &'a BlindedElement<CS>>>(
&self,
blinded_elements: I,
) -> VoprfServerBatchEvaluatePreparedEvaluationElements<CS, I>where
CS: 'a,
Alternative version of batch_blind_evaluate without memory allocation.
Returned PreparedEvaluationElement have to be
collected and passed into
batch_blind_evaluate_finish.
Sourcepub fn batch_blind_evaluate_finish<'a, 'b, R: TryRng + TryCryptoRng, IB: Iterator<Item = &'a BlindedElement<CS>> + ExactSizeIterator, IE>(
&self,
rng: &mut R,
blinded_elements: IB,
evaluation_elements: &'b IE,
) -> Result<VoprfServerBatchEvaluateFinishResult<'b, CS, IE>>where
CS: 'a + 'b,
&'b IE: IntoIterator<Item = &'b PreparedEvaluationElement<CS>>,
<&'b IE as IntoIterator>::IntoIter: ExactSizeIterator,
pub fn batch_blind_evaluate_finish<'a, 'b, R: TryRng + TryCryptoRng, IB: Iterator<Item = &'a BlindedElement<CS>> + ExactSizeIterator, IE>(
&self,
rng: &mut R,
blinded_elements: IB,
evaluation_elements: &'b IE,
) -> Result<VoprfServerBatchEvaluateFinishResult<'b, CS, IE>>where
CS: 'a + 'b,
&'b IE: IntoIterator<Item = &'b PreparedEvaluationElement<CS>>,
<&'b IE as IntoIterator>::IntoIter: ExactSizeIterator,
See batch_blind_evaluate_prepare
for more details.
§Errors
Error::Batch if the number of blinded_elements and
evaluation_elements don’t match or is longer then u16::MAX
Sourcepub fn evaluate(
&self,
input: &[u8],
) -> Result<Output<<CS as CipherSuite>::Hash>>
pub fn evaluate( &self, input: &[u8], ) -> Result<Output<<CS as CipherSuite>::Hash>>
Computes the output of the POPRF on the server side
§Errors
Error::Input if the input is longer then u16::MAX.
Sourcepub fn get_public_key(&self) -> <CS::Group as Group>::Elem
pub fn get_public_key(&self) -> <CS::Group as Group>::Elem
Retrieves the server’s public key