feat(comid): add CryptoKeys (tag 13) support to Mval #251
+55
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Mval struct was missing the CryptoKeys field, which corresponds to CBOR tag 13 in the CoRIM specification. This field is critical for PSA Profile compliance and without this we cannot represent the PSA endorsements.
Solution:
Updated the comid (inside measurement.go) package to support this tag as a first-class citizen:
CryptoKeysfield to the Mval struct with the correct struct tag:CryptoKeys *CryptoKeys
cbor:"13,keyasint,omitempty" json:"cryptokeys,omitempty"Tag 13: Ensures the field is marshaled to the correct integer key in the CBOR map.
2.Added func (o *Measurement) AddCryptoKey(key *CryptoKey) to simplify appending keys to a measurement.
Added a test
TestMeasurement_CryptoKeys_RoundTripto verify that CryptoKeys are correctly marshaled to CBOR and unmarshaled back without data loss.Results:
TestMeasurement_CryptoKeys_RoundTrippassed which means it was able encode and decode the cryptokeys