Initialize a sender for Verified Simplest OT protocol and return the public key and the proof of knowledge of the secret key to be sent to the receiver
(
rng: &mut R,
num_ot: u16,
B: &G,
)
| 143 | /// Initialize a sender for Verified Simplest OT protocol and return the public key and the proof of |
| 144 | /// knowledge of the secret key to be sent to the receiver |
| 145 | pub fn new_verifiable<R: RngCore, D: Digest>( |
| 146 | rng: &mut R, |
| 147 | num_ot: u16, |
| 148 | B: &G, |
| 149 | ) -> Result<(Self, SenderPubKey<G>, PokDiscreteLog<G>), OTError> { |
| 150 | let (setup, S) = Self::new(rng, OTConfig::new_2_message(num_ot)?, B); |
| 151 | let blinding = G::ScalarField::rand(rng); |
| 152 | let schnorr_protocol = PokDiscreteLogProtocol::init(setup.y, blinding, B); |
| 153 | let mut challenge_bytes = vec![]; |
| 154 | schnorr_protocol |
| 155 | .challenge_contribution(B, &S.0, &mut challenge_bytes) |
| 156 | .map_err(|e| OTError::SchnorrError(e))?; |
| 157 | // TODO: Need Transcript here |
| 158 | let challenge = compute_random_oracle_challenge::<G::ScalarField, D>(&challenge_bytes); |
| 159 | let schnorr_proof = schnorr_protocol.gen_proof(&challenge); |
| 160 | Ok((setup, S, schnorr_proof)) |
| 161 | } |
| 162 | |
| 163 | /// Derive the sender's keys using receiver's public key |
| 164 | pub fn derive_keys<D: Default + Update + ExtendableOutput, const KEY_SIZE: u16>( |
nothing calls this directly
no test coverage detected