From 6a22429632195846029c8f85b4e23b03cfe54388 Mon Sep 17 00:00:00 2001 From: Armin Friedl Date: Sat, 8 Feb 2020 09:56:41 +0100 Subject: [PATCH] Remove From for Certificate Deserialization from a path is a heavy conversion. This should be done by an explicit `Certificate::new_from_cbor` call. --- coffer-common/src/certificate.rs | 7 ------- coffer-common/src/keyring.rs | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/coffer-common/src/certificate.rs b/coffer-common/src/certificate.rs index 893d653..54e44a7 100644 --- a/coffer-common/src/certificate.rs +++ b/coffer-common/src/certificate.rs @@ -106,10 +106,3 @@ impl Certificate { Ok(sealedbox::seal(message, pk)) } } - -impl > From for Certificate { - fn from(path: T) -> Self { - Certificate::new_from_cbor(&path) - .expect(&format!{"Could not read certificate from {}", path.as_ref().display()}) - } -} diff --git a/coffer-common/src/keyring.rs b/coffer-common/src/keyring.rs index 7179b15..ec00547 100644 --- a/coffer-common/src/keyring.rs +++ b/coffer-common/src/keyring.rs @@ -53,7 +53,7 @@ impl Keyring { where T: AsRef { Keyring { - certificate: Certificate::from(certificate_path), + certificate: Certificate::new_from_cbor(certificate_path).unwrap(), known_keys: HashMap::new() } }