diff --git a/tpke/src/ciphertext.rs b/tpke/src/ciphertext.rs index a358ff93..42c12727 100644 --- a/tpke/src/ciphertext.rs +++ b/tpke/src/ciphertext.rs @@ -61,6 +61,7 @@ impl Ciphertext { } } + // FIXME: Remove? pub fn serialized_length(&self) -> usize { self.commitment.serialized_size(Compress::No) + self.auth_tag.serialized_size(Compress::No) @@ -201,6 +202,7 @@ fn hash_to_g2( ) -> Result { let point = htp_bls12381_g2(message); let mut point_ser: Vec = Vec::new(); + // TODO: ???? point.serialize_compressed(&mut point_ser)?; T::deserialize_compressed(&point_ser[..]).map_err(Error::ArkSerializeError) } @@ -244,7 +246,11 @@ mod tests { let plaintext = decrypt_symmetric(&ciphertext, aad, &privkey, g_inv).unwrap(); - assert_eq!(msg, plaintext) + assert_eq!(msg, plaintext); + + let bad: &[u8] = "bad-aad".as_bytes(); + + assert!(decrypt_symmetric(&ciphertext, bad, &privkey, g_inv).is_err()); } #[test]