Skip to content

Commit

Permalink
Minor fixes required during PR review
Browse files Browse the repository at this point in the history
Small fixes.

Signed-off-by: Flavio Castelli <[email protected]>
Co-authored-by: Matthew James Briggs <[email protected]>
  • Loading branch information
flavio and webern committed Jan 26, 2022
1 parent 5ad6f66 commit b6e4c0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tough/src/schema/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Signed<Root>>(include_str!(
Expand Down
6 changes: 1 addition & 5 deletions tough/src/schema/decoded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ pub struct EcdsaFlex {}
impl Decode for EcdsaFlex {
fn decode(s: &str) -> Result<Vec<u8>, 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)
}
Expand Down

0 comments on commit b6e4c0f

Please sign in to comment.