-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only one eat.Profile in UnsignedCorim
Bring our implementation in line with the recent [corim spec][1] by replacing Profiles []eat.Profile field in UnsignedCorim with a single profile (multiple profiles have not been allowed since revision 00). This change required updating test cases that relied on hard-coded cbor binary dumps. To make this easier in the future, allow generating them from YAML descriptions. The test cases are now kept in external cbor files rather than hard-coded in the source (Go's embed mechanism is used to allow test code to remain the same), along with YAML sources. A script is provided to re-generate the CBOR from YAML. In the future, when the structures change, YAML source can be edited to reflect the change, and the script then used to re-generate the CBOR. note: YAML is used rather than JSON (which we already use for cocli "templates") because it provides native support for binary strings/arrays. JSON has no mechanism to distinguish between a string that is a string, and a string that is a base64-encoding of binary data. For cocli, the type of the struct field being unmarshaled is used to make the distinction. For these test cases we do not want to rely of pre-defined struct, and so conversion is done using only types native to the formats, hence YAML's support for byte data via !!binary tag is essential. [1]: https://datatracker.ietf.org/doc/html/draft-ietf-rats-corim-04 Signed-off-by: Sergei Trofimov <[email protected]>
- Loading branch information
Showing
26 changed files
with
393 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"kty": "EC", | ||
"crv": "P-256", | ||
"x": "MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4", | ||
"y": "4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM", | ||
"d": "870MB6gfuTJ4HtUnUvYMyJpr5eUZNP4Bk43bVdj3eAE", | ||
"use": "enc", | ||
"kid": "1" | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/bash | ||
# Copyright 2024 Contributors to the Veraison project. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
set -e | ||
|
||
GEN_TESTCASE=$(go env GOPATH)/bin/gen-testcase | ||
|
||
if [[ ! -f ${GEN_TESTCASE} ]]; then | ||
echo "installing gen-testcase" | ||
|
||
go install github.com/setrofim/[email protected] | ||
fi | ||
|
||
testcases=( | ||
psa-refval | ||
test-comid | ||
test-coswid | ||
test-cots | ||
) | ||
|
||
signed_testcases=( | ||
signed-corim-valid | ||
signed-corim-invalid | ||
signed-corim-valid-with-cots | ||
) | ||
|
||
for case in "${testcases[@]}"; do | ||
echo "generating ${case}.cbor" | ||
|
||
${GEN_TESTCASE} "src/${case}.yaml" -o "${case}.cbor" | ||
done | ||
|
||
for case in "${signed_testcases[@]}"; do | ||
echo "generating ${case}.cbor" | ||
|
||
${GEN_TESTCASE} -s ec-p256.jwk -m "src/${case}-meta.yaml" "src/${case}.yaml" \ | ||
-o "${case}.cbor" | ||
done | ||
|
||
echo "done." |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.