From 3852453cf267e04badfde08e04c46c672fb657a8 Mon Sep 17 00:00:00 2001 From: Denis Varlakov Date: Thu, 21 Sep 2023 11:53:10 +0000 Subject: [PATCH] Impl Debug for AnyEncryptionKey --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 1f76d0b..0faf447 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,8 @@ pub mod utils; #[cfg(feature = "serde")] mod serde; +use std::fmt; + use rand_core::{CryptoRng, RngCore}; use rug::Integer; @@ -217,3 +219,11 @@ impl AnyEncryptionKey for DecryptionKey { self.encryption_key().in_signed_group(x) } } + +impl fmt::Debug for dyn AnyEncryptionKey { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PaillierEncKey") + .field("N", self.n()) + .finish_non_exhaustive() + } +}