|
|
@ -322,10 +322,11 @@ impl Drop for SecretKey { |
|
|
|
self.zero_secret(); |
|
|
|
self.zero_secret(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// A debug statement where the secret prime field element is redacted.
|
|
|
|
/// A debug statement where the secret prime field element is redacted.
|
|
|
|
impl fmt::Debug for SecretKey { |
|
|
|
impl fmt::Debug for SecretKey { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
f.debug_tuple("SecretKey").field(&"...").finish() |
|
|
|
f.debug_tuple("SecretKey").field(&DebugDots).finish() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -422,7 +423,7 @@ impl Distribution<SecretKeyShare> for Standard { |
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Debug for SecretKeyShare { |
|
|
|
impl fmt::Debug for SecretKeyShare { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
f.debug_tuple("SecretKeyShare").field(&"...").finish() |
|
|
|
f.debug_tuple("SecretKeyShare").field(&DebugDots).finish() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -519,7 +520,7 @@ impl Ciphertext { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// A decryption share. A threshold of decryption shares can be used to decrypt a message.
|
|
|
|
/// A decryption share. A threshold of decryption shares can be used to decrypt a message.
|
|
|
|
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq)] |
|
|
|
#[derive(Clone, Deserialize, Serialize, PartialEq, Eq)] |
|
|
|
pub struct DecryptionShare(#[serde(with = "serde_impl::projective")] G1); |
|
|
|
pub struct DecryptionShare(#[serde(with = "serde_impl::projective")] G1); |
|
|
|
|
|
|
|
|
|
|
|
impl Distribution<DecryptionShare> for Standard { |
|
|
|
impl Distribution<DecryptionShare> for Standard { |
|
|
@ -534,6 +535,12 @@ impl Hash for DecryptionShare { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Debug for DecryptionShare { |
|
|
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
|
|
|
|
f.debug_tuple("DecryptionShare").field(&DebugDots).finish() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// A public key and an associated set of public key shares.
|
|
|
|
/// A public key and an associated set of public key shares.
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] |
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] |
|
|
|
pub struct PublicKeySet { |
|
|
|
pub struct PublicKeySet { |
|
|
@ -773,6 +780,16 @@ fn into_fr_plus_1<I: IntoFr>(x: I) -> Fr { |
|
|
|
result |
|
|
|
result |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Type that implements `Debug` printing three dots. This can be used to hide the contents of a
|
|
|
|
|
|
|
|
/// field in a `Debug` implementation.
|
|
|
|
|
|
|
|
struct DebugDots; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl fmt::Debug for DebugDots { |
|
|
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
|
|
|
|
write!(f, "...") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)] |
|
|
|
#[cfg(test)] |
|
|
|
mod tests { |
|
|
|
mod tests { |
|
|
|
use super::*; |
|
|
|
use super::*; |
|
|
|