*: Derive Debug and Clone(#2495)

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Nazar Mokrynskyi
2022-02-16 17:16:54 +02:00
committed by GitHub
parent 9f1114d8b9
commit 65cc8994a6
16 changed files with 44 additions and 9 deletions

View File

@ -63,7 +63,7 @@ use std::convert::{TryFrom, TryInto};
/// let keypair = Keypair::rsa_from_pkcs8(&mut bytes);
/// ```
///
#[derive(Clone)]
#[derive(Debug, Clone)]
pub enum Keypair {
/// An Ed25519 keypair.
Ed25519(ed25519::Keypair),

View File

@ -33,6 +33,14 @@ use zeroize::Zeroize;
#[derive(Clone)]
pub struct Keypair(Arc<RsaKeyPair>);
impl std::fmt::Debug for Keypair {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("Keypair")
.field("public", self.0.public_key())
.finish()
}
}
impl Keypair {
/// Decode an RSA keypair from a DER-encoded private key in PKCS#8 PrivateKeyInfo
/// format (i.e. unencrypted) as defined in [RFC5208].