Skip to content

Commit 1651e4d

Browse files
committed
fix: Remove compatibility code and align all tests with multiple authorized-by keys
Addresses reviewer feedback from setrofim in PR #219: - Remove unnecessary compatibility implementation as CoRIM spec is in draft - Align all tests and examples with current implementation instead of maintaining compatibility Core Changes: - comid/measurement.go: Changed AuthorizedBy from *CryptoKey to *CryptoKeys (arrays) - comid/cryptokeys.go: Added String() method returning array representation - coev/coswid_evidence.go: Updated AuthorizedBy to use CryptoKeys - coserv/quads.go: Updated authorities to use CryptoKeys arrays Test Data Updates: - Updated all JSON templates to use array format for authorized-by - Updated diagnostic files (.diag) to use CBOR array syntax [554(...)] - Regenerated all CBOR test files using cbor-diag tool - Updated expected test outputs to show 'CryptoKeys: [...]' format Testing: - All packages now pass tests: comid, comid/tdx, coev, coev/tdx, coserv - Supports multiple authorized-by keys as required by issue #195 - No backward compatibility - clean implementation for draft spec Fixes #195
1 parent ba1fd4e commit 1651e4d

29 files changed

+96
-69
lines changed

coev/coswid_evidence.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010

1111
// CoSWIDEvidenceMap is the Map to carry CoSWID Evidence
1212
type CoSWIDEvidenceMap struct {
13-
TagID *swid.TagID `cbor:"0,keyasint,omitempty" json:"tagId,omitempty"`
14-
Evidence swid.Evidence `cbor:"1,keyasint,omitempty" json:"evidence,omitempty"`
15-
AuthorizedBy *comid.CryptoKey `cbor:"2,keyasint,omitempty" json:"authorized-by,omitempty"`
13+
TagID *swid.TagID `cbor:"0,keyasint,omitempty" json:"tagId,omitempty"`
14+
Evidence swid.Evidence `cbor:"1,keyasint,omitempty" json:"evidence,omitempty"`
15+
AuthorizedBy *comid.CryptoKeys `cbor:"2,keyasint,omitempty" json:"authorized-by,omitempty"`
1616
}
1717

1818
type CoSWIDEvidence []CoSWIDEvidenceMap

coev/example_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,12 @@ func Example_decode_JSON() {
298298
"raw-value-mask": "/////w==",
299299
"mac-addr": "02:00:5e:10:00:00:00:02"
300300
},
301-
"authorized-by": {
302-
"type": "pkix-base64-key",
303-
"value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==\n-----END PUBLIC KEY-----"
304-
}
301+
"authorized-by": [
302+
{
303+
"type": "pkix-base64-key",
304+
"value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==\n-----END PUBLIC KEY-----"
305+
}
306+
]
305307
}
306308
]
307309
}

coev/tdx/example_pce_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,9 @@ func Example_decode_PCE_Evidence_CBOR() {
213213
// ISVSVN: 0
214214
// ISVSVN: 0
215215
// ISVSVN: 0
216-
// CryptoKey Type: pkix-base64-key
217-
// CryptoKey Value: -----BEGIN PUBLIC KEY-----
216+
// CryptoKeys: [-----BEGIN PUBLIC KEY-----
218217
// MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==
219-
// -----END PUBLIC KEY-----
218+
// -----END PUBLIC KEY-----]
220219
}
221220

222221
func ExtractPceEvidence(ce *coev.TaggedConciseEvidence) error {

coev/tdx/example_qe_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ func Example_decode_QE_Evidence_JSON() {
4848
// TEE TCB Status = UpToDate
4949
// Tee AdvisoryID = INTEL-SA-00078
5050
// Tee AdvisoryID = INTEL-SA-00079
51-
// CryptoKey Type: pkix-base64-key
52-
// CryptoKey Value: -----BEGIN PUBLIC KEY-----
51+
// CryptoKeys: [-----BEGIN PUBLIC KEY-----
5352
// MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==
54-
// -----END PUBLIC KEY-----
53+
// -----END PUBLIC KEY-----]
5554
}
5655

5756
func Example_encode_tdx_qe_evidence_without_profile() {
@@ -201,10 +200,9 @@ func Example_decode_QE_Evidence_CBOR() {
201200
// TEE TCB Status = UpToDate
202201
// Tee AdvisoryID = INTEL-SA-00078
203202
// Tee AdvisoryID = INTEL-SA-00079
204-
// CryptoKey Type: pkix-base64-key
205-
// CryptoKey Value: -----BEGIN PUBLIC KEY-----
203+
// CryptoKeys: [-----BEGIN PUBLIC KEY-----
206204
// MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==
207-
// -----END PUBLIC KEY-----
205+
// -----END PUBLIC KEY-----]
208206
}
209207

210208
func ExtractQeEvidence(ce *coev.TaggedConciseEvidence) error {

coev/tdx/example_seam_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,9 @@ func Example_decode_CBOR() {
196196
// mrsigner Digest Value: e45b72f5c0c0b572db4d8d3ab7e97f368ff74e62347a824decb67a84e5224d75
197197
// mrsigner Digest Alg: 7
198198
// mrsigner Digest Value: e45b72f5c0c0b572db4d8d3ab7e97f368ff74e62347a824decb67a84e5224d75e45b72f5c0c0b572db4d8d3ab7e97f36
199-
// CryptoKey Type: pkix-base64-key
200-
// CryptoKey Value: -----BEGIN PUBLIC KEY-----
199+
// CryptoKeys: [-----BEGIN PUBLIC KEY-----
201200
// MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==
202-
// -----END PUBLIC KEY-----
201+
// -----END PUBLIC KEY-----]
203202
}
204203

205204
func ExtractSeamEvidence(ce *coev.TaggedConciseEvidence) error {

coev/tdx/test_vars.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ var (
7272
]
7373
}
7474
},
75-
"authorized-by": {
76-
"type": "pkix-base64-key",
77-
"value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==\n-----END PUBLIC KEY-----"
78-
}
75+
"authorized-by": [
76+
{
77+
"type": "pkix-base64-key",
78+
"value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==\n-----END PUBLIC KEY-----"
79+
}
80+
]
7981
}
8082
]
8183
}
1 Byte
Binary file not shown.
1 Byte
Binary file not shown.
1 Byte
Binary file not shown.

coev/tdx/testcases/src/ce-pce-evidence.diag

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
],
3737
/ pceid / -80 : "0000"
3838
},
39-
/ authorized-by / 2 : 554("-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==\n-----END PUBLIC KEY-----")
39+
/ authorized-by / 2 : [
40+
554("-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFn0taoAwR3PmrKkYLtAsD9o05KSM6mbgfNCgpuL0g6VpTHkZl73wk5BDxoV7n+Oeee0iIqkW3HMZT3ETiniJdg==\n-----END PUBLIC KEY-----")
41+
]
4042
}
4143
]
4244
]

0 commit comments

Comments
 (0)