Skip to content

Add CBOR and CWT support - #63

Merged
setrofim merged 3 commits into
mainfrom
setrofim/cbor
Oct 21, 2026
Merged

setrofim merged 3 commits into
mainfrom
setrofim/cbor

Conversation

@setrofim

Copy link
Copy Markdown
Contributor

Support CBOR encoding of attestation results, and creation and verification of signed CWTs.

@setrofim
setrofim requested a review from a team as a code owner October 15, 2026 16:07
@setrofim
setrofim requested review from thomas-fossati and yogeshbdeshpande and removed request for a team October 15, 2026 16:08
@setrofim
setrofim force-pushed the setrofim/cbor branch 2 times, most recently from 7aa446b to 72e51ae Compare October 16, 2026 09:10
Comment thread attestation_result.go
Comment thread submods.go
Comment thread arc/cmd/create.go Outdated
Comment thread arc/cmd/verify.go Outdated
Comment thread arc/cmd/verify.go
Comment thread attestation_result.go Outdated
Comment thread cbor.go
Comment thread submods.go Outdated
Comment thread cbor.go
Comment thread go.mod
@setrofim
setrofim force-pushed the setrofim/cbor branch 3 times, most recently from 5e23c9e to 7631cca Compare October 16, 2026 11:56
Comment thread attestation_result.go
Comment thread attestation_result.go Outdated
Comment thread cbor.go
Comment thread trusttier.go Outdated
@setrofim
setrofim force-pushed the setrofim/cbor branch 2 times, most recently from 5da44c5 to 460224a Compare October 16, 2026 13:57
Comment thread attestation_result.go
@thomas-fossati

thomas-fossati commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Sergei, did you see #63 (comment) ?
I added it on the fly and only just realised that it was on a "resolved" thread, so it may have slipped your attention. (That'd be my last standing review comment.)

@setrofim

Copy link
Copy Markdown
Contributor Author

Sergei, did you see #63 (comment) ?

Missed it. Now addressed.

@thomas-fossati thomas-fossati left a comment

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.

🚢 it, thanks!

Comment thread arc/cmd/verify.go Outdated
Comment thread appraisal_test.go Outdated
Comment thread attestation_result.go Outdated
Comment thread attestation_result.go
// AttestationResult represents the result of one or more evidence Appraisals
// by the verifier. It is serialized to JSON and signed by the verifier using
// JWT.
type AttestationResult struct {

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.

A minor point but checking the EAR spec, the CDDL says EAR = { }

and EAR means Eat Attestation Results,

the line 51 should be re-named to type AttestationResults {

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.

No. Go types do not have to match the spec names exactly, and in this case, renaming would only lead to confusion. Pluralised names typically refer to collections so AttestationResults would imply a collection of AttestatonResult.

Also, FWIW, the section is called "EAT Attestation Result" (singular): https://www.ietf.org/archive/id/draft-ietf-rats-ear-04.html#name-eat-attestation-result. The the CDDL symbol EAR is representing a single result, regardless of how the acronym "EAR" usually decodes.

Comment thread attestation_result.go

@yogeshbdeshpande yogeshbdeshpande left a comment

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.

Have reviewed it and left some comments for you to have a look at!

Comment thread attestation_result.go
@@ -255,8 +290,11 @@ func (o *AttestationResult) Map() map[eat.IntOrString]any {
// trustworthy if had been manually set that way). If submods contain nested
// tokens, an attempt is made to verify its signature using provided keys. If
// no keys were provided, or if verification fails using all provided keys,

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.

I am not sure the original intent at Line 291 that Verification Fails, the the status TrustTierIncomplete is justifiable. A quick check on Ar4Si states the following:

`Incomplete: The Verifier was unable to complete its appraisal of this aspect of trustworthiness.

Value 1: The Evidence received contains unknown elements which the Verifier is unable to evaluate. An example might be that the wrong type of Evidence has been delivered. Another case is that of Evidence coming from a composite Attester: a Verifier may understand only part of it and leave as "unknown" the Trustworthiness claims related to features it can't appraise.

Value -1: A verifier malfunction occurred during the Verifier's appraisal processing.`

None fits the cause. For Verification Failure it should be "ContraIndicated"

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.

Not sure I fully understand. Is this an objection to the term "failure"? If so then that absolutely applies to TrustTierIncomplete, both in plain English (if a full appraisal was not possible, it by definition failed) and by intent in AR4SI (TrustTierIncomplete is the highest severity tier, higher even than TrustTierContraindicated).

Comment thread attestation_result.go
return o.fromJWTToken(token)
}

// SignCWT validates the AttestationResult object, encodes it to CBOR and wraps it

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.

Just a question, is the X.509, Signing and subsequent Verification will also be part of the flow in future?

@setrofim setrofim Oct 21, 2026 •

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.

No. That does not belong here. Both CWT and JWT paths take a key that is used to sign/verify. That key could be obtained from a cert, but verification of the cert chain and extraction of the key from it are operations that are completely orthogonal to EAR (the spec itself does not mention certs).

Comment thread trustvector.go Outdated
Add CBOR encoding support to EAR types.

Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
Add support for creating, verifying, and extracting attestation results
form CWTs. Attetation result now has SignCWT, as well as verified and
unverified FromXXXCWT() methods and functions that exist for JWT.

arc has also been updated to work with CWTs. "create" command  now has a
--cwt flag to indicate that a CWT, rather than JWT, should be created.
"verify" command determines whether it has a CWT or JWT based on initial
bytes.

Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
Previous commit pushed coverage of arc/cmd to just below 90%. There is
nothing that can be sensibly tested in the additions -- the drop is due
to a switch that translates algorithm. To exercise other paths would
require generating (valid!) keys that use those algorithms and adding
them to test vars.

Instead I'm bumping the coverage of the "root" command (which the
culprit for low overall arc/cmd coverage) by exercising paths that are
not used in other tests. These paths do not error, so there is nothing
to check. The new test is purely to bump reported coverage for root.go
(and therefore arc/cmd subpackage).

Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
Comment thread arc/cmd/verify.go

@yogeshbdeshpande yogeshbdeshpande left a comment

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.

LGTM!

@setrofim
setrofim merged commit 1294ce6 into main Oct 21, 2026
15 checks passed
@setrofim
setrofim deleted the setrofim/cbor branch October 21, 2026 16:33
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.

3 participants