Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b7bbcae
Add: Docs for CoMID Template Format
ravjot07 Dec 24, 2024
b995937
minor changes
ravjot07 Dec 24, 2024
d5f6ccc
Update data/comid/README.md
ravjot07 Dec 25, 2024
9a70845
Update Readme: add examples and diagrams
ravjot07 Dec 27, 2024
d2e7ffd
Merge branch 'docs' of https://github.com/ravjot07/cocli into docs
ravjot07 Dec 27, 2024
41453a0
minor changes
ravjot07 Dec 27, 2024
b4038e1
Docs: CoRIM template Format
ravjot07 Dec 30, 2024
b60c154
Update: diagrams to mermaid format and some minor changes
ravjot07 Jan 4, 2025
1a28a31
fix(docs): Update README for Windows Bash auto-completion and correct…
Priyanshuthapliyal2005 Dec 22, 2024
a05f8fb
update window bash to git bash
Priyanshuthapliyal2005 Dec 23, 2024
f44bd62
Update: corim display Command to Support Unsigned CoRIMs
ravjot07 Dec 20, 2024
9cfeed7
Refractor code into more modeluar function
ravjot07 Dec 22, 2024
d4963e7
minor changes
ravjot07 Dec 22, 2024
7427ebf
Fixes: ci issue
ravjot07 Dec 23, 2024
5a9919d
Add: Docs for CoMID Template Format
ravjot07 Dec 24, 2024
9e820d9
minor changes
ravjot07 Dec 24, 2024
1447a59
Update Readme: add examples and diagrams
ravjot07 Dec 27, 2024
c470890
Update data/comid/README.md
ravjot07 Dec 25, 2024
d554494
minor changes
ravjot07 Dec 27, 2024
eac2206
Docs: CoRIM template Format
ravjot07 Dec 30, 2024
a32b99e
Update: diagrams to mermaid format and some minor changes
ravjot07 Jan 4, 2025
19fcbf4
Removed pngs and updated links
ravjot07 Jan 7, 2025
7cecd10
Removed pngs and updated links
ravjot07 Jan 7, 2025
e312487
minor changes
ravjot07 Jan 7, 2025
d77c838
testing prelinks
ravjot07 Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions data/comid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@

# CoMID Template Format

## Introduction

**CoMID (Concise Model Identifier)**, is a structured tag that encapsulates detailed information about the composition of hardware, firmware, or modules. Each CoMID is uniquely identified by a specific ID, enabling unambiguous reference to CoMID instances, particularly in contexts such as typed link relations or CoBOM (Concise Bill of Material) tags.

## Template Structure

A CoMID template is a JSON document composed of **top-level fields** and a **triples** object. The **top-level fields** provide overall identification, language, and authorship, while the **triples** object contains domain-specific data (e.g., reference values, attester keys).

```
{
"lang": "<language-region>",
"tag-identity": { ... },
"entities": [ ... ],
"triples": {
"reference-values": [ ... ],
"attester-verification-keys": [ ... ]
...
}
}
```

### Top-Level Fields

- **lang** (`String`): Defines the language or locale (e.g., `"en-GB"`).
- **tag-identity** (`Object`): Uniquely identifies this CoMID document via an ID (often a UUID) and includes a version number.
- **entities** (`Array`): Lists the entities (organizations, individuals, etc.) contributing to or maintaining the document, along with their roles.

### Triples

- **reference-values**: One or more **reference-value** objects, each containing an **environment** and one or more **measurements**.
- **attester-verification-keys**: One or more **attester-verification-key** objects, each containing an **environment** and an array of **attestation public key**.


## Components

### Environment

An **environment** captures the context of a measurement or verification key:

- **class**: Vendor, model, and possibly an ID (`type` + `value`).
- **instance** (`optional`): For distinguishing multiple instances of the same environment (e.g., using `ueid` or `uuid`).
- **layer** and **index** (`optional`): For layered environments (e.g., DICE layers in multi-stage boot processes).

### Measurements

Each measurement has two crucial subfields:

- **key**: Identifies the measurement, including possible fields like `label`, `version`, and `signer-id`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

These don’t match the CoMID spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@deeglaze could you be more specfic as i got it in most of the templates like


            "key": {
              "type": "psa.refval-id",
              "value": {
                "label": "PRoT",
                "version": "1.3.5",
                "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="
              }
            }

- **value**: Holds the actual measurement data (e.g., cryptographic digests, raw values, or operational flags).

### Attester Verification Keys

Used to store **public keys** associated with an environment. This is essential for verifying the attestation claims or measurement signatures produced by that environment.

## Field-By-Field Explanation

### Global Fields
| Field | Type | Description | Example |
|:------------: |:------: |:-------------------------------------------------------: |:--------------------------------------------: |
| lang | String | Language/country code. | "en-GB" |
| tag-identity | Object | Identity of this CoMID tag (UUID + version). | "id": "43BBE37F-2E61-4B33-AED3-53CFF1428B16" |
| entities | Array | The organizations/roles associated with this CoMID tag. | [ { "name": "ACME Ltd." ... } ] |

### Reference-Value Fields
| Field | Type | Description | Example |
|:------------------:|:------:|:----------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------:|
| environment | Object | Contains class and optionally instance, layer, index. | See 3.1 Environment. |
Copy link
Collaborator

Choose a reason for hiding this comment

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

This enumeration confuses what is optional and required, as well as what is where. The layer and index are optional fields of class, whereas instance is at the same level as class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravjot07 take a look at these here:- https://github.com/ravjot07/cocli/tree/docs/data/comid#42-reference-value-fields
actually i had simply used excel file for these tables and then later converted it into md format using online tools like table converter

| measurements | Array | List of measurement objects. | [ { "key": { ... }, "value": { ... } } ] |
| measurements.key | Object | Identifies the measurement. Could be a psa.refval-id, cca.platform-config-id, etc. | { "type": "psa.refval-id", "value": { "label": "BL", "version": "2.1.0", ... } } |
| measurements.value | Object | Holds the actual measurement data. | { "digests": ["sha-256:..."] }, or { "raw-value": { "type": "bytes", "value": "..." } }, etc. |

### Attester-Verification-Key Fields
| Field | Type | Description | Example |
|:-----------------:|:------:|:---------------------------------------:|:---------------------------------------------------------------------------:|
| environment | Object | Defines the environment for these keys. | See 3.1 Environment. |
| verification-keys | Array | Holds one or more public keys. | [ { "type": "pkix-base64-key", "value": "-----BEGIN PUBLIC KEY-----..." } ] |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Still would rename these

----------

### High Level Structure for CoMID Templates

```mermaid
graph TD
A[CoMID Template] --> B[Global Fields]
A --> C[Triples]
B --> B1[lang]
B --> B2[tag-identity]
B --> B3[entities]
C --> C1[Reference Values]
C --> C2[Attester Verification Keys]
C1 --> C1a[Environment]
C1 --> C1b[Measurements]
C2 --> C2a[Environment]
C2 --> C2b[Verification Keys]
```

## Full Examples and Walkthroughs

Below are the **seven** template files, each highlighting different aspects of CoMID usage.

### comid-cca-mult-refval.json
Copy link
Contributor

@thomas-fossati thomas-fossati Jan 6, 2025

Choose a reason for hiding this comment

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

(I thought I had made this comment in the previous review cycle, but I cannot find it here, so...)

Rather than making verbatim copies of the files (which will eventually go out of sync), it's better to reference the originals here.

GitHub has a "code snippet" functionality that comes in handy: by copying the permalink to the JSON file (and adding the wanted lines range), the file is embedded in the rendered markdown -- which is pretty cool.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be a bit more concrete: using the permalink to comid-cca-mult-refval.json (including explicit line range) https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93 will render as:

{
"lang": "en-GB",
"tag-identity": {
"id": "43BBE37F-2E61-4B33-AED3-53CFF1428B16",
"version": 0
},
"entities": [
{
"name": "ACME Ltd.",
"regid": "https://acme.example",
"roles": [
"tagCreator",
"creator",
"maintainer"
]
}
],
"triples": {
"reference-values": [
{
"environment": {
"class": {
"id": {
"type": "psa.impl-id",
"value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE="
},
"vendor": "ACME",
"model": "RoadRunner"
}
},
"measurements": [
{
"key": {
"type": "psa.refval-id",
"value": {
"label": "BL",
"version": "2.1.0",
"signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="
}
},
"value": {
"digests": [
"sha-256:h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc="
]
}
},
{
"key": {
"type": "psa.refval-id",
"value": {
"label": "PRoT",
"version": "1.3.5",
"signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="
}
},
"value": {
"digests": [
"sha-256:AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8="
]
}
},
{
"key": {
"type": "psa.refval-id",
"value": {
"label": "ARoT",
"version": "0.1.4",
"signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="
}
},
"value": {
"digests": [
"sha-256:o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg="
]
}
},
{
"key": {
"type": "cca.platform-config-id",
"value": "cfg v1.0.0"
},
"value": {
"raw-value": {
"type": "bytes",
"value": "cmF3dmFsdWUKcmF3dmFsdWUK"
}
}
}
]
}
]
}
}


[comid-cca-mult-refval.json](https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work as intended? I understand from the GitHub docs you just need to slap the bare permalink URI on a separate line, without any wrapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yaa this does not works as intended, i will add bare permalink

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thomas-fossati sir a also tried bare link but it does not work as intended

Copy link
Contributor

Choose a reason for hiding this comment

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

It's because you are working on a fork (I think). To work, the permalink must refer to the local repo. Try and test it with a permalink to the same files but in the ravjot07/cocli repo. If that works (it should), just replace them with the permalinks to the veraison/cocli copies. Leap of faith! :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure @thomas-fossati i will give it a try


**Key Points**

- **Multiple Reference Values**: Demonstrates multiple reference values within a single environment.
- **Identifier Types**: Uses `psa.impl-id` for environment identifier.
- **Diverse Measurement Keys**: Showcases different measurement keys (`psa.refval-id` and `cca.platform-config-id`).
- **Raw Values**: Includes raw byte values for platform configuration.

### comid-cca-realm-refval.json

[comid-cca-realm-refval.json](https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93)

**Key Points**

- **UUID Identifiers**: Utilizes `uuid` type for environment identifiers, ensuring uniqueness.
- **Instance Field**: Includes an `instance` field of type `bytes` to differentiate instances.
- **Integrity Registers**: Uses `integrity-registers` to hold multiple cryptographic hash values across different measurement registers (`rim`, `rem0`, `rem1`, etc.).
- **Operational Flags**: Contains `op-flags` indicating properties like `notSecure` and `debug`.
- **Software Version Number (svn)**: Specifies software versioning with exact values.

### comid-cca-refval.json

[comid-cca-realm-refval.json](https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93)

**Key Points**

- **Multiple Reference-Value Entries**: Illustrates handling of multiple reference values within a single CoMID.
- **Operational Flags**: Uses `op-flags` to indicate operational states like `notSecure` and `debug`.
- **Software Version Numbers (svn)**: Uses `svn` to specify exact software versions for each measurement.
- **Layered Environments**: Demonstrates multi-layered environments (e.g., layer 0 and layer 1) with unique identifiers.
- **Digest Arrays**: Shows multiple digest entries within a single measurement for enhanced integrity verification.

### comid-dice-refval.json

[comid-cca-realm-refval.json](https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93)

**Key Points**

- **DICE Framework Integration**: The file name `comid-dice-refval.json` suggests integration with the DICE framework, which utilizes layered measurements for enhanced security.
- **Layered Measurements**: Contains multiple layers (`layer`: 0 and `layer`: 1), each with distinct environments and measurements.
- **Operational Flags**: Includes flags like `notSecure` and `debug` to indicate the operational state of each environment.
- **Software Version Numbers (svn)**: Uses `svn` to specify exact software versions for each measurement.
- **Multiple Digests**: Some measurements contain multiple digests to strengthen integrity verification.

### comid-psa-iakpub.json

[comid-cca-realm-refval.json](https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93)

**Key Points**

- **Public Keys for Attestation**: Stores two **verification-keys** under different **instances** (`ueid`: Unique Entity Identifier), enabling attesters to verify measurements or claims.
- **Key Formats**: Utilizes `pkix-base64-key` type, ensuring keys are in a standard PEM format.
- **Consistent Environment Class**: Both verification keys are associated with the same `class` (`psa.impl-id`, `vendor`, `model`), indicating they belong to the same hardware or firmware class.
- **Unique Instances**: Differentiates verification keys using unique `ueid` values, allowing multiple keys per environment.

### comid-psa-integ-iakpub.json

[comid-cca-realm-refval.json](https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-cca-mult-refval.json#L1-L93)

**Key Points**

- **Integration with PSA**: The file name indicates integration with the Platform Security Architecture (PSA), emphasizing secure key management.
- **Multiple Verification Keys**: Similar to `comid-psa-iakpub.json`, this file includes multiple verification keys, each associated with distinct `ueid` instances.
- **Key Material Variations**: Demonstrates how different environments can have unique key materials, enhancing security through key separation.
- **Consistent Class Definition**: Maintains the same `class` details across verification keys, ensuring they are recognized as part of the same environment.

### comid-psa-refval.json

- https://github.com/veraison/cocli/blob/0d8fae8210ae527589792de2fba54442302380f7/data/comid/templates/comid-psa-refval.json#L1

**Key Points**

- **Consistent Reference Values**: All reference values utilize the `psa.refval-id` type, maintaining consistency in measurement identification.
- **Uniform Digest Algorithm**: Employs `sha-256` across all measurements, ensuring uniform integrity verification.
- **Signer Identification**: Each measurement includes a `signer-id`, linking the digest to its trusted signer.
- **Standard Structure**: Adheres to the standard CoMID structure for PSA-based reference values, facilitating interoperability and ease of verification.


### Lifecycle of a CoMID Templates

```mermaid
flowchart TD
A[Start] --> B[Parse Command-Line Arguments]
B --> C{Templates Provided?}
C -- Yes --> D[Compile List of Template Files]
C -- No --> E[Error: No Templates Supplied]
E --> F[Exit]
D --> G{Files Found?}
G -- Yes --> H[Iterate Over Each Template]
G -- No --> I[Error: No Files Found]
I --> F
H --> J[Read Template File]
J --> K[Decode JSON Template]
K --> L[Validate Template Structure]
L --> M{Is Valid?}
M -- Yes --> N[Convert JSON to CBOR]
M -- No --> O[Log Validation Error]
O --> P{More Templates?}
P -- Yes --> H
P -- No --> Q{Errors Encountered?}
Q -- Yes --> R[Report Total Errors]
Q -- No --> S[Report Success]
R --> F
S --> F
N --> T[Determine Output Filename]
T --> U[Write CBOR File to Output Directory]
U --> P
```
Loading
Loading