From 2b2a39f843ec92ac509b103c77b3068f9e055273 Mon Sep 17 00:00:00 2001 From: Arshdeep Singh Date: Tue, 23 May 2023 11:16:43 -0400 Subject: [PATCH] add ECDSA_256r1N in condition when checking if code is transferable (#148) * add ECDSA_256r1N in condition when checking if code is transferable Signed-off-by: arshdeep singh * fix format and updated version Signed-off-by: arshdeep singh --------- Signed-off-by: arshdeep singh --- Cargo.toml | 2 +- src/core/matter/mod.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6a0e84a..f791e85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cesride" -version = "0.6.0" +version = "0.6.1" edition = "2021" description = "Cryptographic primitives for use with Composable Event Streaming Representation (CESR)" license = "Apache-2.0" diff --git a/src/core/matter/mod.rs b/src/core/matter/mod.rs index 8c9e8aa..09022ad 100644 --- a/src/core/matter/mod.rs +++ b/src/core/matter/mod.rs @@ -171,8 +171,12 @@ pub trait Matter: Default { } fn transferable(&self) -> bool { - const CODES: &[&str] = - &[tables::Codex::Ed25519N, tables::Codex::ECDSA_256k1N, tables::Codex::Ed448N]; + const CODES: &[&str] = &[ + tables::Codex::Ed25519N, + tables::Codex::ECDSA_256k1N, + tables::Codex::Ed448N, + tables::Codex::ECDSA_256r1N, + ]; !CODES.contains(&self.code().as_str()) } @@ -817,8 +821,10 @@ mod test { #[rstest] #[case(TestMatter::new_with_code_and_raw(matter::Codex::Ed25519, b"00000000000000000000000000000000").unwrap(), true)] #[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256k1, b"000000000000000000000000000000000").unwrap(), true)] + #[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256r1, b"000000000000000000000000000000000").unwrap(), true)] #[case(TestMatter::new_with_code_and_raw(matter::Codex::Ed25519N, b"00000000000000000000000000000000").unwrap(), false)] #[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256k1N, b"000000000000000000000000000000000").unwrap(), false)] + #[case(TestMatter::new_with_code_and_raw(matter::Codex::ECDSA_256r1N, b"000000000000000000000000000000000").unwrap(), false)] fn transferable(#[case] matter: TestMatter, #[case] result: bool) { assert_eq!(matter.transferable(), result); }