Improve measurements verification with Rekor (#206)

Fetched measurements are now verified using Rekor in addition to a signature check.
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
Fabian Kammel 2022-10-11 13:57:52 +02:00 committed by GitHub
parent 1c29638421
commit 57b8efd1ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1320 additions and 322 deletions

View file

@ -231,6 +231,7 @@ func TestMeasurementsFetchAndVerify(t *testing.T) {
signatureStatus int
publicKey []byte
wantMeasurements Measurements
wantSHA string
wantError bool
}{
"simple": {
@ -242,6 +243,7 @@ func TestMeasurementsFetchAndVerify(t *testing.T) {
wantMeasurements: Measurements{
0: []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
},
wantSHA: "4cd9d6ed8d9322150dff7738994c5e2fabff35f3bae6f5c993412d13249a5e87",
},
"404 measurements": {
measurements: "0: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\n",
@ -307,12 +309,13 @@ func TestMeasurementsFetchAndVerify(t *testing.T) {
})
m := Measurements{}
err := m.FetchAndVerify(context.Background(), client, measurementsURL, signatureURL, tc.publicKey)
hash, err := m.FetchAndVerify(context.Background(), client, measurementsURL, signatureURL, tc.publicKey)
if tc.wantError {
assert.Error(err)
return
}
assert.Equal(tc.wantSHA, hash)
assert.NoError(err)
assert.EqualValues(tc.wantMeasurements, m)
})