pub fn show_key(&self) -> Result<Vec<String>> {
        fn format_hex(bytes: &[u8], separator: &str, every: usize) -> Result<String> {
            use std::fmt::Write;
            let mut ret = String::new();
            let mut wait = every;
            for b in bytes.iter() {
                if wait == 0 {
                    ret.push_str(separator);
                    wait = every;
                }
                wait -= 1;
                write!(ret, "{:02X}", b).map_err(|e| format!("{:?}", e))?;
            }
            Ok(ret)
        }
        use pgp::types::KeyTrait;
        let mut ret = Vec::new();
        ret.push(format!("from {}", self));
        let key = self.key();
        let keyid = format_hex(&key.key_id().to_vec(), "-", 4)?;
        let algo = key.algorithm();
        let fpr = format_hex(&key.fingerprint(), " ", 2)?;
        let uid0 = key
            .details
            .users
            .get(0)
            .map(|u| u.id.id())
            .unwrap_or("<No User ID>");
        ret.push(format!("  {:?}/{} - {}", algo, keyid, uid0));
        ret.push(format!("  Fingerprint: {}", fpr));
        Ok(ret)
    }
/// Display the key in detail for the user
Display the key in detail for the user
Display the key in detail for the user
pub fn show_key(&self) -> Result<Vec<String>> {
        fn format_hex(bytes: &[u8], separator: &str, every: usize) -> Result<String> {
            use std::fmt::Write;
            let mut ret = String::new();
            let mut wait = every;
            for b in bytes.iter() {
                if wait == 0 {
                    ret.push_str(separator);
                    wait = every;
                }
                wait -= 1;
                write!(ret, "{:02X}", b).map_err(|e| format!("{:?}", e))?;
            }
            Ok(ret)
        }
        use pgp::types::KeyTrait;
        let mut ret = Vec::new();
        ret.push(format!("from {}", self));
        let key = self.key();
        let keyid = format_hex(&key.key_id().to_vec(), "-", 4)?;
        let algo = key.algorithm();
        let fpr = format_hex(&key.fingerprint(), " ", 2)?;
        let uid0 = key
            .details
            .users
            .get(0)
            .map(|u| u.id.id())
            .unwrap_or("<No User ID>");
        ret.push(format!("  {:?}/{} - {}", algo, keyid, uid0));
        ret.push(format!("  Fingerprint: {}", fpr));
        Ok(ret)
    }
pub fn show_key ( & self ) -> Result < Vec < String > > { fn format_hex ( bytes : & [ u8 ] , separator : & str , every : usize ) -> Result < String > { use std :: fmt :: Write ; let mut ret = String :: new ( ) ; let mut wait = every ; for b in bytes . iter ( ) { if wait == 0 { ret . push_str ( separator ) ; wait = every ; } wait -= 1 ; write ! ( ret " " b ) . map_err ( | e | format ! ( " " e ) ) ? ; } Ok ( ret ) } use pgp :: types :: KeyTrait ; let mut ret = Vec :: new ( ) ; ret . push ( format ! ( " " self ) ) ; let key = self . key ( ) ; let keyid = format_hex ( & key . key_id ( ) . to_vec ( ) , " " , 4 ) ? ; let algo = key . algorithm ( ) ; let fpr = format_hex ( & key . fingerprint ( ) , " " , 2 ) ? ; let uid0 = key . details . users . get ( 0 ) . map ( | u | u . id . id ( ) ) . unwrap_or ( " " ) ; ret . push ( format ! ( " " algo keyid uid0 ) ) ; ret . push ( format ! ( " " fpr ) ) ; Ok ( ret ) }
Display the key in detail for the user
Display the key in detail for the user
&self