Skip to content

Commit be7283a

Browse files
committed
Addressing comments/issues
Signed-off-by: Alex Tzonkov <4975715+attzonko@users.noreply.github.com>
1 parent 051c0c5 commit be7283a

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

.github/workflows/validate-reports.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ jobs:
175175
run: |
176176
cd shortform_report-main
177177
178-
# Find a sample JSON file to test conversion
179-
sample_json=$(find ../Reports/ -name "*.json" -not -name "*_converted*" | head -1)
178+
# Use a specific JSON file for testing conversion
179+
sample_json="../Reports/CHIPS_Alliance/2024/Caliptra/caliptra_fw_report.json"
180180
181-
if [ -n "$sample_json" ] && [ -f "$sample_json" ]; then
181+
if [ -f "$sample_json" ]; then
182182
echo "Testing conversion of: $sample_json"
183183
184184
# Convert JSON to CoRIM
@@ -199,9 +199,8 @@ jobs:
199199
exit 1
200200
fi
201201
else
202-
echo "ℹ️ No sample JSON files found for conversion testing"
202+
echo "ℹ️ Test JSON file not found: $sample_json"
203203
echo "Running final validation summary instead..."
204-
cd shortform_report-main
205204
python tests/final_validation_summary.py
206205
fi
207206

shortform_report-main/tests/final_validation_summary.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,39 @@ def validate_corim_compliance():
275275
encryption_algorithm=serialization.NoEncryption()
276276
)
277277

278-
if report.sign_corim_report_pem(private_pem, "ES512", "test-validation-key"):
278+
# Sign the CoRIM report
279+
signing_result = report.sign_corim_report_pem(private_pem, "ES512", "test-validation-key")
280+
if signing_result:
279281
signed_corim = report.get_signed_corim_report()
280282
print(f"✓ CoRIM signing successful ({len(signed_corim)} bytes)")
281283
print("✓ COSE-Sign1 format with cwt library")
284+
285+
# Validate the signature is actually valid
286+
try:
287+
import cwt
288+
from cwt import COSEKey
289+
290+
# Extract public key from private key for verification
291+
public_key = private_key.public_key()
292+
public_pem = public_key.public_bytes(
293+
encoding=serialization.Encoding.PEM,
294+
format=serialization.PublicFormat.SubjectPublicKeyInfo
295+
)
296+
297+
# Create COSE key for verification with proper key ID
298+
cose_key = COSEKey.from_pem(public_pem, kid="test-validation-key")
299+
300+
# Verify the signature
301+
verified_payload = cwt.decode(signed_corim, cose_key)
302+
if verified_payload:
303+
print("✓ Signature verification successful")
304+
else:
305+
print("✗ Signature verification failed - invalid signature")
306+
return False
307+
308+
except Exception as verify_error:
309+
print(f"✗ Signature verification failed: {verify_error}")
310+
return False
282311
else:
283312
print("✗ CoRIM signing failed")
284313
return False

0 commit comments

Comments
 (0)