From b6e4c0f4dc872115488de73d492990b2ececf854 Mon Sep 17 00:00:00 2001 From: Flavio Castelli Date: Wed, 26 Jan 2022 15:49:59 +0100 Subject: [PATCH] Minor fixes required during PR review Small fixes. Signed-off-by: Flavio Castelli Co-authored-by: Matthew James Briggs --- tough/src/schema/de.rs | 3 +++ tough/src/schema/decoded.rs | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tough/src/schema/de.rs b/tough/src/schema/de.rs index b59b3619d..4f4094111 100644 --- a/tough/src/schema/de.rs +++ b/tough/src/schema/de.rs @@ -87,6 +87,9 @@ mod tests { .is_err()); } + /// Ensure that we can deserialize a root.json file that has hex-encoded ECDSA keys. This uses + /// sigstore's root.json file taken from here: + /// https://sigstore-tuf-root.storage.googleapis.com/2.root.json #[test] fn ecdsa_hex_encoded_keys() { assert!(serde_json::from_str::>(include_str!( diff --git a/tough/src/schema/decoded.rs b/tough/src/schema/decoded.rs index ccd8abc78..a8655640e 100644 --- a/tough/src/schema/decoded.rs +++ b/tough/src/schema/decoded.rs @@ -139,11 +139,7 @@ pub struct EcdsaFlex {} impl Decode for EcdsaFlex { fn decode(s: &str) -> Result, Error> { if s.starts_with("-----BEGIN ") { - spki::decode( - spki::OID_EC_PUBLIC_KEY, - Some(spki::OID_EC_PARAM_SECP256R1), - s, - ) + EcdsaPem::decode(s) } else { Hex::decode(s) }