Skip to content

Commit

Permalink
Rename Veraison extension claims
Browse files Browse the repository at this point in the history
Rename Veraison extension claims to match the 2023 profile of draft-ear.

Signed-off-by: Sergei Trofimov <[email protected]>
  • Loading branch information
setrofim committed Feb 15, 2023
1 parent 408f1e5 commit 99b28b2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions arc/data/ear-claims-extension-ok.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"build": "rrtrap-v1.0.0",
"developer": "Acme Inc."
},
"ear.veraison.processed-evidence": {
"ear.veraison.annotated-evidence": {
"k1": "v1",
"k2": "v2"
},
"ear.veraison.verifier-added-claims": {
"ear.veraison.policy-claims": {
"foo": "bar",
"bar": "baz"
}
Expand Down
8 changes: 4 additions & 4 deletions ear_appraisal.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ type Appraisal struct {
// attached to the Appraisal. For now only veraison-specific extensions are
// supported.
type AppraisalExtensions struct {
VeraisonProcessedEvidence *map[string]interface{} `json:"ear.veraison.processed-evidence,omitempty"`
VeraisonVerifierAddedClaims *map[string]interface{} `json:"ear.veraison.verifier-added-claims,omitempty"`
VeraisonAnnotatedEvidence *map[string]interface{} `json:"ear.veraison.annotated-evidence,omitempty"`
VeraisonPolicyClaims *map[string]interface{} `json:"ear.veraison.policy-claims,omitempty"`
}

// UpdateStatusFromTrustVector ensure that Status trustworthiness is not
Expand Down Expand Up @@ -77,8 +77,8 @@ func ToAppraisal(v interface{}) (*Appraisal, error) {
"ear.trustworthiness-vector": func(v interface{}) (interface{}, error) {
return ToTrustVector(v)
},
"ear.veraison.processed-evidence": stringMapPtrParser,
"ear.veraison.verifier-added-claims": stringMapPtrParser,
"ear.veraison.annotated-evidence": stringMapPtrParser,
"ear.veraison.policy-claims": stringMapPtrParser,
}

err := populateStructFromMap(&appraisal, m, "json", parsers, stringPtrParser, true)
Expand Down
8 changes: 4 additions & 4 deletions ear_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ var (
Status: &testStatus,
AppraisalPolicyID: &testPolicyID,
AppraisalExtensions: AppraisalExtensions{
VeraisonVerifierAddedClaims: &map[string]interface{}{
VeraisonPolicyClaims: &map[string]interface{}{
"foo": "bar",
"bar": "baz",
},
VeraisonProcessedEvidence: &map[string]interface{}{
VeraisonAnnotatedEvidence: &map[string]interface{}{
"k1": "v1",
"k2": "v2",
},
Expand Down Expand Up @@ -161,9 +161,9 @@ func TestUnmarshalJSON_fail(t *testing.T) {
func TestVerify_pass(t *testing.T) {
tvs := []string{
// ok
`eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlYXRfcHJvZmlsZSI6InRhZzpnaXRodWIuY29tLDIwMjM6dmVyYWlzb24vZWFyIiwiaWF0IjoxNjY2MDkxMzczLCJlYXIudmVyaWZpZXItaWQiOnsiYnVpbGQiOiJycnRyYXAtdjEuMC4wIiwiZGV2ZWxvcGVyIjoiQWNtZSBJbmMuIn0sInN1Ym1vZHMiOnsidGVzdCI6eyJlYXIuc3RhdHVzIjoiYWZmaXJtaW5nIiwiZWFyLmFwcHJhaXNhbC1wb2xpY3ktaWQiOiJwb2xpY3k6Ly90ZXN0LzAxMjM0IiwiZWFyLnZlcmFpc29uLnByb2Nlc3NlZC1ldmlkZW5jZSI6eyJrMSI6InYxIiwiazIiOiJ2MiJ9LCJlYXIudmVyYWlzb24udmVyaWZpZXItYWRkZWQtY2xhaW1zIjp7ImZvbyI6ImJhciIsImJhciI6ImJheiJ9fX19.FXAemadK7KeYYPvOQjPGw0ona3PBiL-QJL6_QUPj_fK6RpcZR9H9mw_eM3qnVyNt5QY6S8Rxm083UbbMWexrZg`,
`eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlYXIudmVyaWZpZXItaWQiOnsiYnVpbGQiOiJycnRyYXAtdjEuMC4wIiwiZGV2ZWxvcGVyIjoiQWNtZSBJbmMuIn0sImVhdF9wcm9maWxlIjo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sImJhciI6ImJheiJ9fX19.FXAemadK7KeYYPvOQjPGw0ona3PBiL-QJL6_QUPj_fK6RpcZR9H9mw_eM3qnVyNt5QY6S8Rxm083UbbMWexrZg.trailing-rubbish`,
`eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJlYXIudmVyaWZpZXItaWQiOnsiYnVpbGQiOiJycnRyYXAtdjEuMC4wIiwiZGV2ZWxvcGVyIjoiQWNtZSBJbmMuIn0sImVhdF9wcm9maWxlIjoidGFnOmdpdGh1Yi5jb20sMjAyMzp2ZXJhaXNvbi9lYXIiLCJpYXQiOjEuNjY2MDkxMzczZSswOSwianRpIjoiMTY1Zjg0YzY3YzE0ZTEwZDFlNGI0MzM0MDgzY2IyYTIxZDI2YmYxN2FhNjBkNWU5ZGE5ZDhmNzE3NmFjNWI2MyIsIm5iZiI6MTY3NjQ3MjcwOSwic3VibW9kcyI6eyJ0ZXN0Ijp7ImVhci5hcHByYWlzYWwtcG9saWN5LWlkIjoicG9saWN5Oi8vdGVzdC8wMTIzNCIsImVhci5zdGF0dXMiOiJhZmZpcm1pbmciLCJlYXIudmVyYWlzb24uYW5ub3RhdGVkLWV2aWRlbmNlIjp7ImsxIjoidjEiLCJrMiI6InYyIn0sImVhci52ZXJhaXNvbi5wb2xpY3ktY2xhaW1zIjp7ImJhciI6ImJheiIsImZvbyI6ImJhciJ9fX19.LunlKAnUiVHZxIUr7jNnrwFlRtd7t6f6W1rzIFgcWFLdtJELKIVGkPVV5PriHh8T0uLLIEJafwvi6hmIr27aDw.trailing-rubbish`,
}

k, err := jwk.ParseKey([]byte(testECDSAPublicKey))
Expand Down
10 changes: 5 additions & 5 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func Example_encode_veraison_extensions() {
fmt.Println(string(j))

// Output:
// {"ear.verifier-id":{"build":"rrtrap-v1.0.0","developer":"Acme Inc."},"eat_profile":"tag:github.com,2023:veraison/ear","iat":1666091373,"submods":{"test":{"ear.appraisal-policy-id":"policy://test/01234","ear.status":"affirming","ear.veraison.processed-evidence":{"k1":"v1","k2":"v2"},"ear.veraison.verifier-added-claims":{"bar":"baz","foo":"bar"}}}}
// {"ear.verifier-id":{"build":"rrtrap-v1.0.0","developer":"Acme Inc."},"eat_profile":"tag:github.com,2023:veraison/ear","iat":1666091373,"submods":{"test":{"ear.appraisal-policy-id":"policy://test/01234","ear.status":"affirming","ear.veraison.annotated-evidence":{"k1":"v1","k2":"v2"},"ear.veraison.policy-claims":{"bar":"baz","foo":"bar"}}}}
}

func Example_decode_veraison_extensions() {
Expand All @@ -82,11 +82,11 @@ func Example_decode_veraison_extensions() {
"test": {
"ear.status": "affirming",
"ear.appraisal-policy-id": "policy://test/01234",
"ear.veraison.processed-evidence": {
"ear.veraison.annotated-evidence": {
"k1": "v1",
"k2": "v2"
},
"ear.veraison.verifier-added-claims": {
"ear.veraison.policy-claims": {
"bar": "baz",
"foo": "bar"
}
Expand All @@ -97,8 +97,8 @@ func Example_decode_veraison_extensions() {
_ = ar.UnmarshalJSON([]byte(j))

fmt.Println(TrustTierToString[*ar.Submods["test"].Status])
fmt.Println((*ar.Submods["test"].VeraisonProcessedEvidence)["k1"])
fmt.Println((*ar.Submods["test"].VeraisonVerifierAddedClaims)["bar"])
fmt.Println((*ar.Submods["test"].VeraisonAnnotatedEvidence)["k1"])
fmt.Println((*ar.Submods["test"].VeraisonPolicyClaims)["bar"])

// Output:
// affirming
Expand Down

0 comments on commit 99b28b2

Please sign in to comment.