//! Public key, public subkey, private key and private subkey packets.
use std::fmt;
use std::mem;
use std::cmp::Ordering;
use time;
use nettle::Hash as NettleHash;
use nettle::hash::insecure_do_not_use::Sha1;
use Error;
use crypto::{mpis, Hash, KeyPair, SessionKey};
use packet::Tag;
use packet;
use Packet;
use PublicKeyAlgorithm;
use SymmetricAlgorithm;
use HashAlgorithm;
use constants::Curve;
use crypto::s2k::S2K;
use Result;
use conversions::Time;
use crypto::Password;
use KeyID;
use Fingerprint;
/// Holds a public key, public subkey, private key or private subkey packet.
///
/// See [Section 5.5 of RFC 4880] for details.
///
/// [Section 5.5 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.5
#[derive(PartialEq, Eq, Hash, Clone)]
pub struct Key4 {
/// CTB packet header fields.
pub(crate) common: packet::Common,
/// When the key was created.
creation_time: time::Tm,
/// Public key algorithm of this signature.
pk_algo: PublicKeyAlgorithm,
/// Public key MPIs.
mpis: mpis::PublicKey,
/// Optional secret part of the key.
secret: Option<SecretKey>,
}
impl fmt::Debug for Key4 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Key4")
.field("fingerprint", &self.fingerprint())
.field("creation_time", &format!("{}", self.creation_time.rfc3339()))
.field("pk_algo", &self.pk_algo)
.field("mpis", &self.mpis)
.field("secret", &self.secret)
.finish()
}
}
impl