Skip to content

Commit 3f71447

Browse files
authored
fix(rbac-registration): delete tag (#249)
Signed-off-by: bkioshn <[email protected]>
1 parent 3e0e9eb commit 3f71447

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

rust/rbac-registration/src/cardano/cip509/rbac/certs/c509.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ impl Decode<'_, ProblemReport> for C509Cert {
2828
minicbor::data::Type::Tag => {
2929
let tag = decode_tag(d, "C509Cert")?;
3030
match tag {
31-
t if t == KeyTag::Deleted.tag() => Ok(Self::Deleted),
31+
t if t == KeyTag::Deleted.tag() => {
32+
d.undefined()?;
33+
Ok(Self::Deleted)
34+
},
3235
_ => Err(decode::Error::message("Unknown tag for C509Cert")),
3336
}
3437
},

rust/rbac-registration/src/cardano/cip509/rbac/certs/x509.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl Decode<'_, ProblemReport> for X509DerCert {
2626
minicbor::data::Type::Tag => {
2727
let tag = decode_tag(d, "X509DerCert")?;
2828
match tag {
29-
t if t == KeyTag::Deleted.tag() => Ok(Self::Deleted),
29+
t if t == KeyTag::Deleted.tag() => {
30+
d.undefined()?;
31+
Ok(Self::Deleted)
32+
},
3033
_ => Err(decode::Error::message("Unknown tag for X509DerCert")),
3134
}
3235
},

rust/rbac-registration/src/cardano/cip509/rbac/pub_key.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ impl Decode<'_, ProblemReport> for SimplePublicKeyType {
2525
minicbor::data::Type::Tag => {
2626
let tag = decode_tag(d, "SimplePublicKeyType")?;
2727
match tag {
28-
t if t == KeyTag::Deleted.tag() => Ok(Self::Deleted),
28+
t if t == KeyTag::Deleted.tag() => {
29+
d.undefined()?;
30+
Ok(Self::Deleted)
31+
},
2932
t if t == KeyTag::Ed25519.tag() => {
3033
let bytes = decode_bytes(d, "Ed25519 SimplePublicKeyType")?;
3134
let mut ed25519 = [0u8; 32];
@@ -42,7 +45,11 @@ impl Decode<'_, ProblemReport> for SimplePublicKeyType {
4245
)))
4346
}
4447
},
45-
_ => Err(decode::Error::message("Unknown tag for Self")),
48+
_ => {
49+
Err(decode::Error::message(
50+
"Unknown tag for SimplePublicKeyType",
51+
))
52+
},
4653
}
4754
},
4855
minicbor::data::Type::Undefined => {

rust/rbac-registration/src/cardano/cip509/rbac/tag.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ pub(crate) enum KeyTag {
77
/// Deleted Key tag 31.
88
Deleted,
99
/// Ed25519 Key tag 32773.
10+
/// <https://cips.cardano.org/cip/CIP-0115>
1011
Ed25519,
1112
}
1213

1314
impl KeyTag {
1415
/// Get the tag value.
1516
pub(crate) fn tag(self) -> Tag {
1617
match self {
17-
KeyTag::Deleted => Tag::new(0x31),
18-
KeyTag::Ed25519 => Tag::new(0x8005),
18+
KeyTag::Deleted => Tag::new(31),
19+
KeyTag::Ed25519 => Tag::new(32773),
1920
}
2021
}
2122
}

0 commit comments

Comments
 (0)