Adding reflected value check on client side

This commit is contained in:
Kevin Lewi
2021-07-14 18:10:35 -07:00
committed by Kevin Lewi
parent 8de2f37235
commit b4882f8810
7 changed files with 183 additions and 36 deletions
+3 -2
View File
@@ -55,9 +55,10 @@ fn client_registration_roundtrip() {
let pw = b"hunter2";
let mut rng = OsRng;
let sc = <RistrettoPoint as Group>::random_nonzero_scalar(&mut rng);
let elem = <RistrettoPoint as Group>::base_point() * sc;
// serialization order: scalar, password
let bytes: Vec<u8> = [&sc.as_bytes()[..], &pw[..]].concat();
// serialization order: scalar, password, group element
let bytes: Vec<u8> = [&elem.to_arr(), &sc.as_bytes()[..], &pw[..]].concat();
let reg = ClientRegistration::<Default>::deserialize(&bytes[..]).unwrap();
let reg_bytes = reg.serialize();
assert_eq!(reg_bytes, bytes);