Skip to content

Implement ID v4 version#55

Open
Xynnn007 wants to merge 3 commits into
veraison:mainfrom
Xynnn007:ear-rev-4
Open

Implement ID v4 version#55
Xynnn007 wants to merge 3 commits into
veraison:mainfrom
Xynnn007:ear-rev-4

Conversation

@Xynnn007

Copy link
Copy Markdown
Contributor

Close #54

@Xynnn007 Xynnn007 changed the title Implement RFC v4 version Implement ID v4 version Jun 16, 2026
Comment thread src/cmw.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before delving into this, I wanted to ask a question: Have you considered using veraison/rust-cmw?
If so, what made you decide against it?

(I can see how a minimalist implementation of CMW could be a sensible choice in this case. However, I wanted to make sure that you had considered the alternatives.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I did not even realize that there is a rust crate there. Let me take a try and get some response to you

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the CMW struct defined by rust-cmw has its own serialzie/deserialize implementations, s.t. marshal_json and unmarshal_json. At the same time, the ear crate requires the members to implement serde::{Serialize, Deserialize} for cmw, if the cmw struct is used as a member of ear struct.

So maybe an "elegant" way to my side is to firstly support serde::{Serialize, Deserialize} for cmw in rust-cmw, and then use rust-cmw in this PR. Wdyt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great to me.

@ionut-arm, can you think of any reasons why this wouldn’t be beneficial?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yess, @Xynnn007 - that would be a great addition. Since the serde traits don't take an explicit output format, there's a need for the CMW to already have its format defined internally when serializing. At the moment there's no clear way to create a CMW "by hand" and set the expected output format, but that shouldn't be a big addition.

AFAICT deserialize is already implemented and can probably be reused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a simple PR for this veraison/rust-cmw#6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ionut-arm I put another PR veraison/rust-cmw#8

Comment thread CHANGELOG.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an awesome initiative. Thanks very much for this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this. This information should be part of the message for the commit making the changes, and not in a random file in the repo (that will in all likelihood future contributions will forget to update). GitHub will automatically generate a changelog for each release from pull requests and commits. There is absolutely no need to maintain one by hand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following @setrofim 's suggestion, removed

Comment thread src/cmw.rs Outdated
Comment thread src/cmw.rs Outdated
@Xynnn007
Xynnn007 force-pushed the ear-rev-4 branch 2 times, most recently from 85e484d to 42a8f6a Compare June 25, 2026 11:16
@Xynnn007

Copy link
Copy Markdown
Contributor Author

I force pushed with my own repo rev. If veraison/rust-cmw#6 gets merged, I can update the rev.

Xynnn007 and others added 2 commits July 9, 2026 17:39
Update claim names, CBOR keys, and public APIs to match draft-04,
including CMW-based raw evidence, standardized attester and verifier
claims, optional top-level status and topology, and the ietf EAR
profile URI.

Changed:
- Align EAR JSON/CBOR claim names and mappings with draft-ietf-rats-ear-04.
- Update default EAR profile URI to tag:ietf.org,2026:rats/ear#04.
- Update top-level verifier claim from ear.verifier-id to ear_verifier_id (CBOR key 1004).
- Update raw evidence claim from ear.raw-evidence to ear_raw_evidence (CBOR key 1002), encoded as a Record CMW array.
- Update appraisal claim names to draft-04 forms: ear_status (1000), ear_trustworthiness_vector (1001), ear_appraisal_policy_ids (1003).
- Replace Veraison extension-style claims with standardized draft-04 claims:
  annotated_evidence / ear.veraison.annotated-evidence -> attester_claims / ear_attester_claims (1005)
  policy_claims / ear.veraison.policy-claims -> verifier_claims / ear_verifier_claims (1006)
- Add optional top-level EAR fields: status (ear_status, 1000) and topology (ear_device_topology, 1007).
- Keep Veraison key attestation extension as ear_veraison_key_attestation (-70002) and align naming in JSON examples; fix JSON serialization of key_attestation that was previously deserialize-only.

Added:
- Depend on the cmw crate for Record CMW handling in ear_raw_evidence.
  raw_evidence is (de)serialized as a CMW directly through serde for
  both JSON and CBOR, relying on cmw's serde support for both encodings
  (>= 0.2.0); no format-specific handling is needed in this crate.
- Export EAR_PROFILE constant from crate root.
- Add tests that deserialize draft-04-aligned JSON examples and validate
  updated claim names/keys, including a JSON<->CBOR round-trip of
  ear_raw_evidence.

Also fix an elided-lifetime clippy lint in TrustClaim::value_desc.

Breaking Changes:
- Ear.raw_evidence type changed from Option<Bytes> to Option<cmw::CMW>.
- Appraisal fields renamed: annotated_evidence -> attester_claims, policy_claims -> verifier_claims.
- JSON claim names moved from dotted forms (for example ear.status) to underscore forms (for example ear_status) per draft-04.
- Tokens produced with legacy profile or legacy dotted claim names are not wire-compatible with draft-04 tokens.

Migration Notes:
- Use EAR_PROFILE (tag:ietf.org,2026:rats/ear#04) when creating new EAR tokens.
- Build raw evidence with the cmw crate, for example:
  CMW::from_json_value(&serde_json::json!(["application/vnd.evidence", "<base64>"]))
  or CMW::Monad(Monad::new_media_type(mime, bytes, None)?)
- Update downstream parsers/policies to consume ear_* claim names instead of ear.* names.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Update the cargo-rdme README to match the revised lib.rs examples.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Appliment for RFC v4 verison

4 participants