Verify if the proof is valid. Assumes that the public key and parameters have been validated already.
(
&self,
revealed_msgs: &BTreeMap<usize, E::ScalarField>,
challenge: &E::ScalarField,
pk: impl Into<PreparedPublicKeyG2<E>>,
params: impl Into<PreparedSignature
| 250 | /// Verify if the proof is valid. Assumes that the public key and parameters have been |
| 251 | /// validated already. |
| 252 | pub fn verify( |
| 253 | &self, |
| 254 | revealed_msgs: &BTreeMap<usize, E::ScalarField>, |
| 255 | challenge: &E::ScalarField, |
| 256 | pk: impl Into<PreparedPublicKeyG2<E>>, |
| 257 | params: impl Into<PreparedSignatureParams23G1<E>>, |
| 258 | ) -> Result<(), BBSPlusError> { |
| 259 | let params = params.into(); |
| 260 | let g1 = params.g1; |
| 261 | let g2 = params.g2; |
| 262 | let h = params.h; |
| 263 | self.verify_except_pairings(revealed_msgs, challenge, g1, h)?; |
| 264 | |
| 265 | // Verify the randomized signature |
| 266 | if !E::multi_pairing( |
| 267 | [ |
| 268 | E::G1Prepared::from(self.A_bar), |
| 269 | E::G1Prepared::from(-(self.B_bar.into_group())), |
| 270 | ], |
| 271 | [pk.into().0, g2], |
| 272 | ) |
| 273 | .is_zero() |
| 274 | { |
| 275 | return Err(BBSPlusError::PairingCheckFailed); |
| 276 | } |
| 277 | Ok(()) |
| 278 | } |
| 279 | |
| 280 | pub fn verify_with_randomized_pairing_checker( |
| 281 | &self, |