diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-04-02 11:45:12 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-04-02 11:52:36 +0200 |
commit | d272928dc2317cb4f5a2b9a20aa10b515bc3e238 (patch) | |
tree | 7ddb0483b878bbe6ba103cad83437ea5e986acfe | |
parent | c75a4d60e6a10b3559370498a99ab946f6846043 (diff) |
openpgp: Drop Fingerprint::from_hex in favor of FromStr.
- See #462.
-rw-r--r-- | autocrypt/src/lib.rs | 16 | ||||
-rw-r--r-- | net/tests/hkp.rs | 5 | ||||
-rw-r--r-- | openpgp-ffi/src/fingerprint.rs | 2 | ||||
-rw-r--r-- | openpgp/src/crypto/keygrip.rs | 32 | ||||
-rw-r--r-- | openpgp/src/fingerprint.rs | 34 | ||||
-rw-r--r-- | openpgp/src/keyhandle.rs | 10 | ||||
-rw-r--r-- | openpgp/src/keyid.rs | 2 | ||||
-rw-r--r-- | openpgp/src/packet/key.rs | 4 | ||||
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 14 | ||||
-rw-r--r-- | store/src/backend/mod.rs | 8 | ||||
-rw-r--r-- | store/src/lib.rs | 6 | ||||
-rw-r--r-- | tool/src/sq.rs | 4 |
12 files changed, 52 insertions, 85 deletions
diff --git a/autocrypt/src/lib.rs b/autocrypt/src/lib.rs index f336be9a..54133602 100644 --- a/autocrypt/src/lib.rs +++ b/autocrypt/src/lib.rs @@ -792,7 +792,6 @@ impl<'a> AutocryptSetupMessageParser<'a> { mod test { use super::*; - use openpgp::Fingerprint; use openpgp::policy::StandardPolicy as P; #[test] @@ -929,8 +928,7 @@ In the light of the Efail vulnerability I am asking myself if it's let cert = ac.headers[0].key.as_ref() .expect("Failed to parse key material."); assert_eq!(cert.fingerprint(), - Fingerprint::from_hex( - &"156962B0F3115069ACA970C68E3B03A279B772D6"[..]).unwrap()); + "156962B0F3115069ACA970C68E3B03A279B772D6".parse().unwrap()); assert_eq!(cert.userids().next().unwrap().value(), &b"holger krekel <holger@merlinux.eu>"[..]); @@ -952,8 +950,7 @@ In the light of the Efail vulnerability I am asking myself if it's let cert = ac.headers[0].key.as_ref() .expect("Failed to parse key material."); assert_eq!(cert.fingerprint(), - Fingerprint::from_hex( - &"D4AB192964F76A7F8F8A9B357BD18320DEADFA11"[..]).unwrap()); + "D4AB192964F76A7F8F8A9B357BD18320DEADFA11".parse().unwrap()); assert_eq!(cert.userids().next().unwrap().value(), &b"Vincent Breitmoser <look@my.amazin.horse>"[..]); @@ -975,8 +972,7 @@ In the light of the Efail vulnerability I am asking myself if it's let cert = ac.headers[0].key.as_ref() .expect("Failed to parse key material."); assert_eq!(cert.fingerprint(), - Fingerprint::from_hex( - &"4F9F89F5505AC1D1A260631CDB1187B9DD5F693B"[..]).unwrap()); + "4F9F89F5505AC1D1A260631CDB1187B9DD5F693B".parse().unwrap()); assert_eq!(cert.userids().next().unwrap().value(), &b"Patrick Brunschwig <patrick@enigmail.net>"[..]); @@ -1079,8 +1075,7 @@ Autocrypt-Gossip: addr=neal@walfield.org; keydata= let cert = ac.headers[0].key.as_ref() .expect("Failed to parse key material."); assert_eq!(cert.fingerprint(), - Fingerprint::from_hex( - &"C4BC2DDB38CCE96485EBE9C2F20691179038E5C6"[..]).unwrap()); + "C4BC2DDB38CCE96485EBE9C2F20691179038E5C6".parse().unwrap()); assert_eq!(cert.userids().next().unwrap().value(), &b"Daniel Kahn Gillmor <dkg@fifthhorseman.net>"[..]); @@ -1168,8 +1163,7 @@ Autocrypt-Gossip: addr=neal@walfield.org; keydata= // A basic check to make sure we got the key. assert_eq!(asm.into_cert().fingerprint(), - Fingerprint::from_hex( - "E604 68CE 44D7 7C3F CE9F D072 71DB C565 7FDE 65A7") + "E604 68CE 44D7 7C3F CE9F D072 71DB C565 7FDE 65A7".parse() .unwrap()); diff --git a/net/tests/hkp.rs b/net/tests/hkp.rs index 889aeaae..e095213d 100644 --- a/net/tests/hkp.rs +++ b/net/tests/hkp.rs @@ -26,7 +26,6 @@ extern crate sequoia_net; use crate::openpgp::armor::Reader; use crate::openpgp::Cert; -use crate::openpgp::Fingerprint; use crate::openpgp::parse::Parse; use sequoia_core::{Context, NetworkPolicy}; use sequoia_net::KeyServer; @@ -98,7 +97,7 @@ fn service(req: Request<Body>) None)).unwrap(); assert_eq!( key.fingerprint(), - Fingerprint::from_hex(FP) + FP.parse() .unwrap()); }, _ => panic!("Bad post: {}:{}", key, value), @@ -159,7 +158,7 @@ fn get() { let key = core.run(keyserver.get(&keyid)).unwrap(); assert_eq!(key.fingerprint(), - Fingerprint::from_hex(FP).unwrap()); + FP.parse().unwrap()); } #[test] diff --git a/openpgp-ffi/src/fingerprint.rs b/openpgp-ffi/src/fingerprint.rs index 86bb7d21..8ba41f48 100644 --- a/openpgp-ffi/src/fingerprint.rs +++ b/openpgp-ffi/src/fingerprint.rs @@ -70,7 +70,7 @@ fn pgp_fingerprint_from_bytes(buf: *const u8, fn pgp_fingerprint_from_hex(hex: *const c_char) -> Maybe<Fingerprint> { let hex = ffi_param_cstr!(hex).to_string_lossy(); - openpgp::Fingerprint::from_hex(&hex).ok().move_into_raw() + hex.parse::<openpgp::Fingerprint>().ok().move_into_raw() } /// Returns a reference to the raw Fingerprint. diff --git a/openpgp/src/crypto/keygrip.rs b/openpgp/src/crypto/keygrip.rs index 32c58e84..9f48090e 100644 --- a/openpgp/src/crypto/keygrip.rs +++ b/openpgp/src/crypto/keygrip.rs @@ -301,45 +301,45 @@ mod tests { let keygrips: HashMap<FP, KG> = [ // testy.pgp - (FP::from_hex("3E8877C877274692975189F5D03F6F865226FE8B").unwrap(), + ("3E8877C877274692975189F5D03F6F865226FE8B".parse::<FP>().unwrap(), KG::from_hex("71ADDE3BBC0B7F1BFC2DA414C4F473B197763733").unwrap()), - (FP::from_hex("01F187575BD45644046564C149E2118166C92632").unwrap(), + ("01F187575BD45644046564C149E2118166C92632".parse::<FP>().unwrap(), KG::from_hex("CB6149C50DF90DC88626283A6B6C918A1C29E37D").unwrap()), // neal.pgp - (FP::from_hex("8F17777118A33DDA9BA48E62AACB3243630052D9").unwrap(), + ("8F17777118A33DDA9BA48E62AACB3243630052D9".parse::<FP>().unwrap(), KG::from_hex("C45986381F54F967C2F6B104521C8634090F326A").unwrap()), - (FP::from_hex("C03FA6411B03AE12576461187223B56678E02528").unwrap(), + ("C03FA6411B03AE12576461187223B56678E02528".parse::<FP>().unwrap(), KG::from_hex("BE2FE8C8793141322AC30E3EAFD1E4F9D8DACCC4").unwrap()), - (FP::from_hex("50E6D924308DBF223CFB510AC2B819056C652598").unwrap(), + ("50E6D924308DBF223CFB510AC2B819056C652598".parse::<FP>().unwrap(), KG::from_hex("9873FD355DE470DDC151CD9919AC9785C3C2FDDE").unwrap()), - (FP::from_hex("2DC50AB55BE2F3B04C2D2CF8A3506AFB820ABD08").unwrap(), + ("2DC50AB55BE2F3B04C2D2CF8A3506AFB820ABD08".parse::<FP>().unwrap(), KG::from_hex("9483454871CC1239D4C2A1416F2742D39A14DB14").unwrap()), // dennis-simon-anton.pgp - (FP::from_hex("5BFBCD2A23E6866B77198C1147606B18E3D45CE9").unwrap(), + ("5BFBCD2A23E6866B77198C1147606B18E3D45CE9".parse::<FP>().unwrap(), KG::from_hex("D3E87BECEF18FB4C561F3C4E73A92C4D7A43FD90").unwrap()), // testy-new.pgp - (FP::from_hex("39D100AB67D5BD8C04010205FB3751F1587DAEF1").unwrap(), + ("39D100AB67D5BD8C04010205FB3751F1587DAEF1".parse::<FP>().unwrap(), KG::from_hex("DD143ABA8D1D7D09875D6209E01BCF020788FF77").unwrap()), - (FP::from_hex("F4D1450B041F622FCEFBFDB18BD88E94C0D20333").unwrap(), + ("F4D1450B041F622FCEFBFDB18BD88E94C0D20333".parse::<FP>().unwrap(), KG::from_hex("583225FBC0A88293472FB95F37E9595E1367188C").unwrap()), // emmelie-dorothea-dina-samantha-awina-ed25519.pgp - (FP::from_hex("8E8C33FA4626337976D97978069C0C348DD82C19").unwrap(), + ("8E8C33FA4626337976D97978069C0C348DD82C19".parse::<FP>().unwrap(), KG::from_hex("8BFFDC31BCFC3F31304DACD55AC5F15839A64040").unwrap()), - (FP::from_hex("061C3CA44AFF0EC58DC66E9522E3FAFE96B56C32").unwrap(), + ("061C3CA44AFF0EC58DC66E9522E3FAFE96B56C32".parse::<FP>().unwrap(), KG::from_hex("E80BBB4AC2048A708ADB376C6491E8302150DCC9").unwrap()), // erika-corinna-daniela-simone-antonia-nistp256.pgp - (FP::from_hex("B45FB2CD7B227C057D6BD690DA6846EEA212A3C0").unwrap(), + ("B45FB2CD7B227C057D6BD690DA6846EEA212A3C0".parse::<FP>().unwrap(), KG::from_hex("CA791A9F0F2EF0163461BA991BFEB2315EDF13F5").unwrap()), // erika-corinna-daniela-simone-antonia-nistp384.pgp - (FP::from_hex("E837639193664C9BB1C212E70CB719D5AA7D91F1").unwrap(), + ("E837639193664C9BB1C212E70CB719D5AA7D91F1".parse::<FP>().unwrap(), KG::from_hex("625CC3D9A795AD7AC6B666E92E46156917773CBC").unwrap()), // erika-corinna-daniela-simone-antonia-nistp521.pgp - (FP::from_hex("B9E41C493B8988A7EDC502D99A404C898D411DC8").unwrap(), + ("B9E41C493B8988A7EDC502D99A404C898D411DC8".parse::<FP>().unwrap(), KG::from_hex("8F669049015534649776D0F1F439D37EE3F3D948").unwrap()), // keygrip-issue-439.pgp - (FP::from_hex("597B1FEA9F1B91F6749E8A24652CC528EBDA1B20").unwrap(), + ("597B1FEA9F1B91F6749E8A24652CC528EBDA1B20".parse::<FP>().unwrap(), KG::from_hex("EF0CCDE02FFF9E24EFCCBF6F6FFE52716820E497").unwrap()), - (FP::from_hex("7147EB2C548AEF87E425B9543EF9867F7073B689").unwrap(), + ("7147EB2C548AEF87E425B9543EF9867F7073B689".parse::<FP>().unwrap(), KG::from_hex("642314FF90E6F8DA595EF51B7BA6B25071D3B0F1").unwrap()), ].iter().cloned().collect(); diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs index 27038f1f..c83085bd 100644 --- a/openpgp/src/fingerprint.rs +++ b/openpgp/src/fingerprint.rs @@ -1,8 +1,6 @@ use std::fmt; use quickcheck::{Arbitrary, Gen}; -use crate::Result; - /// A long identifier for certificates and keys. /// /// A fingerprint uniquely identifies a public key. For more details @@ -52,7 +50,7 @@ impl std::str::FromStr for Fingerprint { type Err = anyhow::Error; fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { - Self::from_hex(s) + Ok(Self::from_bytes(&crate::fmt::hex::decode_pretty(s)?[..])) } } @@ -68,24 +66,6 @@ impl Fingerprint { } } - /// Reads a hexadecimal fingerprint. - /// - /// This function ignores whitespace. - /// - /// # Example - /// - /// ``` - /// # extern crate sequoia_openpgp as openpgp; - /// # use openpgp::Fingerprint; - /// let hex = "3E8877C877274692975189F5D03F6F865226FE8B"; - /// let fp = Fingerprint::from_hex(hex); - /// assert!(fp.is_ok()); - /// assert_eq!(format!("{:X}", fp.unwrap()), hex); - /// ``` - pub fn from_hex(hex: &str) -> Result<Fingerprint> { - Ok(Fingerprint::from_bytes(&crate::fmt::from_hex(hex, true)?[..])) - } - /// Returns a reference to the raw Fingerprint. pub fn as_slice(&self) -> &[u8] { match self { @@ -198,8 +178,8 @@ mod tests { #[test] fn icao() { - let fpr = Fingerprint::from_hex( - "0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567").unwrap(); + let fpr = "0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567" + .parse::<Fingerprint>().unwrap(); let expected = "\ Zero One Two Three Four Five Six Seven Eight Niner Alpha Bravo Charlie Delta \ Echo Foxtrot Zero One Two Three Four Five Six Seven Eight Niner Alpha Bravo \ @@ -210,8 +190,8 @@ Charlie Delta Echo Foxtrot Zero One Two Three Four Five Six Seven"; #[test] fn hex_formatting() { - let fpr = Fingerprint::from_hex( - "0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567").unwrap(); + let fpr = "0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567" + .parse::<Fingerprint>().unwrap(); assert_eq!(format!("{:X}", fpr), "0123456789ABCDEF0123456789ABCDEF01234567"); assert_eq!(format!("{:x}", fpr), "0123456789abcdef0123456789abcdef01234567"); } @@ -219,7 +199,7 @@ Charlie Delta Echo Foxtrot Zero One Two Three Four Five Six Seven"; #[test] fn fingerprint_is_send_and_sync() { fn f<T: Send + Sync>(_: T) {} - f(Fingerprint::from_hex( - "0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567").unwrap()); + f("0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567" + .parse::<Fingerprint>().unwrap()); } } diff --git a/openpgp/src/keyhandle.rs b/openpgp/src/keyhandle.rs index b8d17e8e..1e8ef0d4 100644 --- a/openpgp/src/keyhandle.rs +++ b/openpgp/src/keyhandle.rs @@ -191,14 +191,12 @@ impl KeyHandle { /// # use openpgp::KeyHandle; /// # /// # let fpr1 : KeyHandle - /// # = Fingerprint::from_hex( - /// # "8F17 7771 18A3 3DDA 9BA4 8E62 AACB 3243 6300 52D9") - /// # .unwrap().into(); + /// # = "8F17 7771 18A3 3DDA 9BA4 8E62 AACB 3243 6300 52D9" + /// # .parse::<Fingerprint>().unwrap().into(); /// # /// # let fpr2 : KeyHandle - /// # = Fingerprint::from_hex( - /// # "0123 4567 8901 2345 6789 0123 AACB 3243 6300 52D9") - /// # .unwrap().into(); + /// # = "0123 4567 8901 2345 6789 0123 AACB 3243 6300 52D9" + /// # .parse::<Fingerprint>().unwrap().into(); /// # /// # let keyid : KeyHandle = "AACB 3243 6300 52D9".parse::<KeyID>() /// # .unwrap().into(); diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs index fc5b7222..d65e2f1c 100644 --- a/openpgp/src/keyid.rs +++ b/openpgp/src/keyid.rs @@ -62,7 +62,7 @@ impl std::str::FromStr for KeyID { } else { // Maybe a fingerprint was given. Try to parse it and // convert it to a KeyID. - Ok(Fingerprint::from_hex(s)?.into()) + Ok(s.parse::<Fingerprint>()?.into()) } } } diff --git a/openpgp/src/packet/key.rs b/openpgp/src/packet/key.rs index 7f40f072..896607f9 100644 --- a/openpgp/src/packet/key.rs +++ b/openpgp/src/packet/key.rs @@ -2006,7 +2006,6 @@ mod tests { #[test] fn import_ed25519() { - use crate::Fingerprint; use crate::types::SignatureType; use crate::packet::signature::Signature4; use crate::packet::signature::subpacket::{ @@ -2021,7 +2020,8 @@ mod tests { let mut hashed = SubpacketArea::default(); let mut unhashed = SubpacketArea::default(); - let fpr = Fingerprint::from_hex("D81A 5DC0 DEBF EE5F 9AC8 20EB 6769 5DB9 920D 4FAC").unwrap(); + let fpr = "D81A 5DC0 DEBF EE5F 9AC8 20EB 6769 5DB9 920D 4FAC" + .parse().unwrap(); let kid = "6769 5DB9 920D 4FAC".parse().unwrap(); let ctime = 1549460479.into(); let r = b"\x5A\xF9\xC7\x42\x70\x24\x73\xFF\x7F\x27\xF9\x20\x9D\x20\x0F\xE3\x8F\x71\x3C\x5F\x97\xFD\x60\x80\x39\x29\xC2\x14\xFD\xC2\x4D\x70"; diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index b028655f..1b523227 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -2907,8 +2907,7 @@ fn subpacket_test_2() { value: SubpacketValue::Issuer(keyid) })); - let fp = Fingerprint::from_hex( - "361A96BDE1A65B6D6C25AE9FF004B9A45C586126").unwrap(); + let fp = "361A96BDE1A65B6D6C25AE9FF004B9A45C586126".parse().unwrap(); assert_eq!(sig.issuer_fingerprint(), Some(&fp)); assert_eq!(sig.subpacket(SubpacketTag::IssuerFingerprint), Some(&Subpacket { @@ -3007,10 +3006,9 @@ fn subpacket_test_2() { value: SubpacketValue::Revocable(false) })); - let fp = Fingerprint::from_hex( - "361A96BDE1A65B6D6C25AE9FF004B9A45C586126").unwrap(); + let fp = "361A96BDE1A65B6D6C25AE9FF004B9A45C586126".parse().unwrap(); let rk = RevocationKey::new(PublicKeyAlgorithm::RSAEncryptSign, - fp.clone(), false); + fp, false); assert_eq!(sig.revocation_keys().nth(0).unwrap(), &rk); assert_eq!(sig.subpacket(SubpacketTag::RevocationKey), Some(&Subpacket { @@ -3029,8 +3027,7 @@ fn subpacket_test_2() { value: SubpacketValue::Issuer(keyid) })); - let fp = Fingerprint::from_hex( - "B59B8817F519DCE10AFD85E4CEAD062109347957").unwrap(); + let fp = "B59B8817F519DCE10AFD85E4CEAD062109347957".parse().unwrap(); assert_eq!(sig.issuer_fingerprint(), Some(&fp)); assert_eq!(sig.subpacket(SubpacketTag::IssuerFingerprint), Some(&Subpacket { @@ -3233,8 +3230,7 @@ fn subpacket_test_2() { value: SubpacketValue::Issuer(keyid) })); - let fp = Fingerprint::from_hex( - "B59B8817F519DCE10AFD85E4CEAD062109347957").unwrap(); + let fp = "B59B8817F519DCE10AFD85E4CEAD062109347957".parse().unwrap(); assert_eq!(sig.issuer_fingerprint(), Some(&fp)); assert_eq!(sig.subpacket(SubpacketTag::IssuerFingerprint), Some(&Subpacket { diff --git a/store/src/backend/mod.rs b/store/src/backend/mod.rs index 91803a42..d9a88373 100644 --- a/store/src/backend/mod.rs +++ b/store/src/backend/mod.rs @@ -229,7 +229,7 @@ impl node::Server for NodeServer { -> Promise<(), capnp::Error> { bind_results!(results); let fingerprint = pry!(pry!(params.get()).get_fingerprint()); - let fingerprint = sry!(Fingerprint::from_hex(fingerprint)); + let fingerprint: openpgp::Fingerprint = sry!(fingerprint.parse()); let key_id = sry!(KeyServer::lookup(&self.c, &fingerprint)); pry!(pry!(results.get().get_result()).set_ok( @@ -335,7 +335,7 @@ impl node::mapping::Server for MappingServer { bind_results!(results); let params = pry!(params.get()); let fp = pry!(params.get_fingerprint()); - let fp = sry!(Fingerprint::from_hex(fp) + let fp = sry!(fp.parse() .map_err(|_| node::Error::MalformedFingerprint)); let label = pry!(params.get_label()); @@ -904,7 +904,7 @@ impl KeyServer { ORDER BY keys.update_at LIMIT 1", &[&network_policy_u8 as &dyn ToSql, &Timestamp::now()], |row| Ok((row.get(0)?, row.get(1)?)))?; - let fingerprint = openpgp::Fingerprint::from_hex(&fingerprint) + let fingerprint = fingerprint.parse::<openpgp::Fingerprint>() .map_err(|_| node::Error::SystemError)?; let ctx = core::Context::configure() @@ -1003,7 +1003,7 @@ impl Query for KeyServer { "SELECT fingerprint FROM keys WHERE id = ?1", &[&self.id], |row| -> rusqlite::Result<String> { row.get(0) }) .ok() - .and_then(|fp| Fingerprint::from_hex(&fp).ok()) + .and_then(|fp| fp.parse::<openpgp::Fingerprint>().ok()) .map(|fp| KeyID::from(fp).to_string()) .unwrap_or( format!("{}::{}", Self::table_name(), self.id()) diff --git a/store/src/lib.rs b/store/src/lib.rs index dc7cb9a5..1d2d65ac 100644 --- a/store/src/lib.rs +++ b/store/src/lib.rs @@ -887,7 +887,7 @@ impl Key { /// # let new = Cert::from_bytes( /// # &include_bytes!("../../openpgp/tests/data/keys/testy-new.pgp")[..]).unwrap(); /// let mapping = Mapping::open(&ctx, REALM_CONTACTS, "default")?; - /// let fp = Fingerprint::from_hex("3E8877C877274692975189F5D03F6F865226FE8B").unwrap(); + /// let fp = "3E8877C877274692975189F5D03F6F865226FE8B".parse().unwrap(); /// let binding = mapping.add("Testy McTestface", &fp)?; /// let key = binding.key()?; /// let r = key.import(&old)?; @@ -1081,7 +1081,7 @@ impl Iterator for BundleIter { self.core.borrow_mut(), request, |r: node::binding_iter::item::Reader| Ok((String::from(r.get_label()?), - openpgp::Fingerprint::from_hex(r.get_fingerprint()?).unwrap(), + r.get_fingerprint().unwrap().parse()?, Binding::new(self.core.clone(), Some(r.get_label()?), r.get_binding()?)))) }; @@ -1104,7 +1104,7 @@ impl Iterator for KeyIter { make_request_map!( self.core.borrow_mut(), request, |r: node::key_iter::item::Reader| - Ok((openpgp::Fingerprint::from_hex(r.get_fingerprint()?).unwrap(), + Ok((r.get_fingerprint().unwrap().parse()?, Key::new(self.core.clone(), r.get_key()?)))) }; doit().ok() diff --git a/tool/src/sq.rs b/tool/src/sq.rs index 3e371927..3e3df364 100644 --- a/tool/src/sq.rs +++ b/tool/src/sq.rs @@ -24,7 +24,7 @@ extern crate sequoia_net; extern crate sequoia_store as store; use crate::openpgp::Result; -use crate::openpgp::{armor, Fingerprint, Cert}; +use crate::openpgp::{armor, Cert}; use sequoia_autocrypt as autocrypt; use crate::openpgp::fmt::hex; use crate::openpgp::types::KeyFlags; @@ -522,7 +522,7 @@ fn main() -> Result<()> { list_bindings(&mapping, realm_name, mapping_name)?; }, ("add", Some(m)) => { - let fp = Fingerprint::from_hex(m.value_of("fingerprint").unwrap()) + let fp = m.value_of("fingerprint").unwrap().parse() .expect("Malformed fingerprint"); mapping.add(m.value_of("label").unwrap(), &fp)?; }, |