Skip to content

Commit

Permalink
chore(deps): update ccatoken, go-cose, psatoken and parsec deps
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Fossati <[email protected]>
  • Loading branch information
thomas-fossati authored and setrofim committed Sep 13, 2024
1 parent f07c94e commit ca7cb17
Show file tree
Hide file tree
Showing 24 changed files with 137 additions and 97 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ require (
github.com/spf13/viper v1.13.0
github.com/stretchr/testify v1.9.0
github.com/tbaehler/gin-keycloak v1.6.1
github.com/veraison/ccatoken v1.1.0
github.com/veraison/ccatoken v1.3.1
github.com/veraison/cmw v0.1.0
github.com/veraison/corim v1.1.3-0.20240814105452-be7ec4829479
github.com/veraison/corim v1.1.3-0.20240911154934-4f141ee6d1e7
github.com/veraison/dice v0.0.1
github.com/veraison/ear v1.1.2
github.com/veraison/eat v0.0.0-20220117140849-ddaf59d69f53
github.com/veraison/parsec v0.1.1-0.20230915122508-f31e6c9be40e
github.com/veraison/psatoken v1.2.0
github.com/veraison/parsec v0.2.1-0.20240912163334-0368b9c16228
github.com/veraison/psatoken v1.2.1-0.20240912124429-aec3ece7886e
go.uber.org/zap v1.23.0
golang.org/x/text v0.14.0
google.golang.org/grpc v1.64.0
Expand Down Expand Up @@ -101,7 +101,7 @@ require (
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/vektah/gqlparser/v2 v2.4.6 // indirect
github.com/veraison/go-cose v1.1.1-0.20230825153510-da0f9a62ade7
github.com/veraison/go-cose v1.3.0-rc.1
github.com/veraison/swid v1.1.1-0.20230911094910-8ffdd07a22ca
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand Down
27 changes: 10 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,7 @@ github.com/danieljoos/wincred v1.1.0/go.mod h1:XYlo+eRTsVA9aHGp7NGjFkPla4m+DCL7h
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ=
Expand Down Expand Up @@ -995,7 +993,6 @@ github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmV
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
github.com/fxamacker/cbor/v2 v2.3.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE=
github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
Expand Down Expand Up @@ -1371,7 +1368,6 @@ github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJG
github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo=
github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
github.com/lestrrat-go/jwx/v2 v2.0.8/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0=
github.com/lestrrat-go/jwx/v2 v2.0.11 h1:ViHMnaMeaO0qV16RZWBHM7GTrAnX2aFLVKofc7FuKLQ=
github.com/lestrrat-go/jwx/v2 v2.0.11/go.mod h1:ZtPtMFlrfDrH2Y0iwfa3dRFn8VzwBrB+cyrm3IBWdDg=
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
Expand Down Expand Up @@ -1729,26 +1725,24 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vektah/gqlparser/v2 v2.4.6 h1:Yjzp66g6oVq93Jihbi0qhGnf/6zIWjcm8H6gA27zstE=
github.com/vektah/gqlparser/v2 v2.4.6/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
github.com/veraison/ccatoken v1.1.0 h1:U0Z5fOQRsdz3ksvvxVzTITczo+kfRxIlkWahJNP6Irs=
github.com/veraison/ccatoken v1.1.0/go.mod h1:qh/KBwsrhPyGJqttlh8PU56wt1rPkUCX9A3ZAA/53Nc=
github.com/veraison/ccatoken v1.3.1 h1:zUHXr2mPprxMYv5Mm2mumxzQZ3I9wy7QGayXqa9Rv/E=
github.com/veraison/ccatoken v1.3.1/go.mod h1:vMqdbW4H/8A3oT+24qssuIK3Aefy06XqzTELGg+gWAg=
github.com/veraison/cmw v0.1.0 h1:vD6tBlGPROCW/HlDcG1jh+XUJi5ihrjXatKZBjrv8mU=
github.com/veraison/cmw v0.1.0/go.mod h1:WoBrlgByc6C1FeHhdze1/bQx1kv5d1sWKO5ezEf4Hs4=
github.com/veraison/corim v1.1.3-0.20240814105452-be7ec4829479 h1:dcKW+Nugh2Cs/ihz6xAmmTfi4v5flaLTg6MiZ8gN3N8=
github.com/veraison/corim v1.1.3-0.20240814105452-be7ec4829479/go.mod h1:sYmwruIqD5+83OcvMg6WUDTTWq8AWM6QbVQhbE9VFQM=
github.com/veraison/corim v1.1.3-0.20240911154934-4f141ee6d1e7 h1:sq9OVQgwpRJDFrQDGAOMs5p22Hp1zfDYRkeb+EVJWTU=
github.com/veraison/corim v1.1.3-0.20240911154934-4f141ee6d1e7/go.mod h1:Wj3a6bSo7+3peVGjwGayHDALILh4PHMngDhgBYUbVLk=
github.com/veraison/dice v0.0.1 h1:dOm7ByDN/r4WlDsGkEUXzdPMXgTvAPTAksQ8+BwBrD4=
github.com/veraison/dice v0.0.1/go.mod h1:QPMLc5LVMj08VZ+HNMYk4XxWoVYGAUBVm8Rd5V1hzxs=
github.com/veraison/ear v1.1.2 h1:Xs41FqAG8IyJaceqNFcX2+nf51Et1uyhmCJV8SZqw/8=
github.com/veraison/ear v1.1.2/go.mod h1:O3yKgZR04DWKHHiNxfXCMX9ky0cLVoC67TFks6JwEhI=
github.com/veraison/eat v0.0.0-20210331113810-3da8a4dd42ff/go.mod h1:+kxt8iuFiVvKRs2VQ1Ho7bbAScXAB/kHFFuP5Biw19I=
github.com/veraison/eat v0.0.0-20220117140849-ddaf59d69f53 h1:5gnX2TrGd/Xz8DOp2OaLtg/jLoIubSUTrgz6iZ58pJ4=
github.com/veraison/eat v0.0.0-20220117140849-ddaf59d69f53/go.mod h1:+kxt8iuFiVvKRs2VQ1Ho7bbAScXAB/kHFFuP5Biw19I=
github.com/veraison/go-cose v1.0.0-rc.1/go.mod h1:7ziE85vSq4ScFTg6wyoMXjucIGOf4JkFEZi/an96Ct4=
github.com/veraison/go-cose v1.1.1-0.20230825153510-da0f9a62ade7 h1:KcKzBthSrSZIUEWBjVvkuk/DE3PyYFbXZxhx5byGFtc=
github.com/veraison/go-cose v1.1.1-0.20230825153510-da0f9a62ade7/go.mod h1:t6V8WJzHm1PD5HNsuDjW3KLv577uWb6UTzbZGvdQHD8=
github.com/veraison/parsec v0.1.1-0.20230915122508-f31e6c9be40e h1:6flWRGWeW9X2GOtegx2MqwRzO4z2DIrk3nm5FH7sGyM=
github.com/veraison/parsec v0.1.1-0.20230915122508-f31e6c9be40e/go.mod h1:IXiVM4dsJNsB2PB1NkK5AE0gUvOzsxLgOpuPo9KHs0M=
github.com/veraison/psatoken v1.2.0 h1:PeHy6YUbhFE9Z9xaQBoAMpMWUEqSHrF2JgfcwMTmFIA=
github.com/veraison/psatoken v1.2.0/go.mod h1:2tHLoYMOIS4V4mO8MJT4VstRtpO50FLmhoOR35FyIr4=
github.com/veraison/go-cose v1.3.0-rc.1 h1:j7mMBdwkbq4c+pgEZVbbWG8UwVIgGHPp6+TAAYJj+UY=
github.com/veraison/go-cose v1.3.0-rc.1/go.mod h1:df09OV91aHoQWLmy1KsDdYiagtXgyAwAl8vFeFn1gMc=
github.com/veraison/parsec v0.2.1-0.20240912163334-0368b9c16228 h1:oMCBfNZ8yxeMHelMg/H8uLrBLRvipjAwBL0d5/F9bvY=
github.com/veraison/parsec v0.2.1-0.20240912163334-0368b9c16228/go.mod h1:hobpAGxGmjCyluLHTNMdgJYficPXno4HZWKJSuUwZ7w=
github.com/veraison/psatoken v1.2.1-0.20240912124429-aec3ece7886e h1:W1OWcrRvfN0EWyldcpFgwl9xdKBbZUlk5pnbLTcR8Ec=
github.com/veraison/psatoken v1.2.1-0.20240912124429-aec3ece7886e/go.mod h1:bXUwdYAGcRoclxe73JmO8Z9ngV9KDHqW20afM9Q0FKo=
github.com/veraison/swid v1.1.1-0.20230911094910-8ffdd07a22ca h1:osmCKwWO/xM68Kz+rIXio1DNzEY2NdJOpGpoy5r8NlE=
github.com/veraison/swid v1.1.1-0.20230911094910-8ffdd07a22ca/go.mod h1:d5jt76uMNbTfQ+f2qU4Lt8RvWOTsv6PFgstIM1QdMH0=
github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
Expand Down Expand Up @@ -1884,7 +1878,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
Expand Down
4 changes: 2 additions & 2 deletions proto/appraisal_context.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/evidence.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/state.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/token.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proto/vts.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions proto/vts_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion provisioning/api/handler.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Contributors to the Veraison project.
// Copyright 2022-2024 Contributors to the Veraison project.
// SPDX-License-Identifier: Apache-2.0
package api

Expand Down
2 changes: 1 addition & 1 deletion provisioning/provisioner/provisioner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 Contributors to the Veraison project.
// Copyright 2022-2024 Contributors to the Veraison project.
// SPDX-License-Identifier: Apache-2.0

package provisioner
Expand Down
17 changes: 6 additions & 11 deletions scheme/arm-cca/evidence_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,18 @@ func (s EvidenceHandler) ExtractClaims(
token *proto.AttestationToken,
trustAnchors []string,
) (map[string]interface{}, error) {

var ccaToken ccatoken.Evidence

if err := ccaToken.FromCBOR(token.Data); err != nil {
ccaToken, err := ccatoken.DecodeAndValidateEvidenceFromCBOR(token.Data)
if err != nil {
return nil, handler.BadEvidence(err)
}

platformClaimsSet, err := common.ClaimsToMap(ccaToken.PlatformClaims)
platformClaimsSet, err := common.ClaimsToMap(common.CcaPlatformWrapper{ccaToken.PlatformClaims}) // nolint:govet
if err != nil {
return nil, handler.BadEvidence(fmt.Errorf(
"could not convert platform claims: %w", err))
}

realmClaimsSet, err := common.ClaimsToMap(ccaToken.RealmClaims)
realmClaimsSet, err := common.ClaimsToMap(common.CcaRealmWrapper{ccaToken.RealmClaims}) // nolint:govet
if err != nil {
return nil, handler.BadEvidence(fmt.Errorf(
"could not convert realm claims: %w", err))
Expand All @@ -72,11 +70,8 @@ func (s EvidenceHandler) ValidateEvidenceIntegrity(
trustAnchors []string,
endorsementsStrings []string,
) error {
var (
ccaToken ccatoken.Evidence
)

if err := ccaToken.FromCBOR(token.Data); err != nil {
ccaToken, err := ccatoken.DecodeAndValidateEvidenceFromCBOR(token.Data)
if err != nil {
return handler.BadEvidence(err)
}

Expand Down
10 changes: 5 additions & 5 deletions scheme/arm-cca/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package arm_cca
import (
"fmt"

"github.com/veraison/ccatoken/platform"
"github.com/veraison/ear"
"github.com/veraison/psatoken"
"github.com/veraison/services/handler"
"github.com/veraison/services/scheme/common"
"github.com/veraison/services/scheme/common/arm"
Expand All @@ -17,7 +17,7 @@ func platformAppraisal(
claimsMap map[string]interface{},
endorsements []handler.Endorsement,
) (*ear.Appraisal, error) {
claims, err := common.MapToClaims(claimsMap)
claims, err := common.MapToCCAPlatformClaims(claimsMap)
if err != nil {
return nil, fmt.Errorf("unable to get claims from platform claims map: %w", err)
}
Expand All @@ -31,9 +31,9 @@ func platformAppraisal(
return nil, handler.BadEvidence(err)
}

lifeCycle := psatoken.CcaLifeCycleToState(rawLifeCycle)
if lifeCycle == psatoken.CcaStateSecured ||
lifeCycle == psatoken.CcaStateNonCcaPlatformDebug {
lifeCycle := platform.LifeCycleToState(rawLifeCycle)
if lifeCycle == platform.StateSecured ||
lifeCycle == platform.StateNonCCAPlatformDebug {
trustVector.InstanceIdentity = ear.TrustworthyInstanceClaim
trustVector.RuntimeOpaque = ear.ApprovedRuntimeClaim
trustVector.StorageOpaque = ear.HwKeysEncryptedSecretsClaim
Expand Down
8 changes: 4 additions & 4 deletions scheme/arm-cca/realm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"errors"
"fmt"

"github.com/veraison/ccatoken"
ccatokenrealm "github.com/veraison/ccatoken/realm"
"github.com/veraison/ear"
"github.com/veraison/services/handler"
"github.com/veraison/services/log"
Expand Down Expand Up @@ -79,7 +79,7 @@ func realmAppraisal(
return &appraisal, nil
}

func matchRim(claims ccatoken.IClaims, endorsement *handler.Endorsement) bool {
func matchRim(claims ccatokenrealm.IClaims, endorsement *handler.Endorsement) bool {
// get RIM Claim from Evidence Claims
rimClaim, err := claims.GetInitialMeasurement()
if err != nil {
Expand All @@ -104,7 +104,7 @@ func matchRim(claims ccatoken.IClaims, endorsement *handler.Endorsement) bool {
return true
}

func matchRpv(claims ccatoken.IClaims, endorsement *handler.Endorsement) error {
func matchRpv(claims ccatokenrealm.IClaims, endorsement *handler.Endorsement) error {
pvClaim, err := claims.GetPersonalizationValue()
if err != nil {
return fmt.Errorf("matchRpv failed: %w", err)
Expand All @@ -122,7 +122,7 @@ func matchRpv(claims ccatoken.IClaims, endorsement *handler.Endorsement) error {
return nil
}

func matchREMs(claims ccatoken.IClaims, endorsement *handler.Endorsement) bool {
func matchREMs(claims ccatokenrealm.IClaims, endorsement *handler.Endorsement) bool {
remMatch := false
remsClaim, err := claims.GetExtensibleMeasurements()
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions scheme/arm-cca/store_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func (s StoreHandler) SynthKeysFromTrustAnchor(tenantID string, ta *handler.Endo
}

func (s StoreHandler) GetTrustAnchorIDs(token *proto.AttestationToken) ([]string, error) {
var evidence ccatoken.Evidence
err := evidence.FromCBOR(token.Data)
evidence, err := ccatoken.DecodeAndValidateEvidenceFromCBOR(token.Data)
if err != nil {
return []string{""}, handler.BadEvidence(err)
}
Expand Down
31 changes: 23 additions & 8 deletions scheme/common/arm/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"encoding/json"
"fmt"

"github.com/veraison/ccatoken/platform"
"github.com/veraison/psatoken"
"github.com/veraison/services/handler"
"github.com/veraison/services/log"
Expand Down Expand Up @@ -63,7 +64,9 @@ func GetPlatformReferenceIDs(
tenantID string,
claims map[string]interface{},
) ([]string, error) {
platformClaims, err := common.MapToClaims(claims)
// Using the PSA specialisation here is ok because Implementation ID is
// mandatory and shared by both PSA and CCA platform.
platformClaims, err := common.MapToPSAClaims(claims)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -105,13 +108,21 @@ func GetTrustAnchorID(scheme string, tenantID string, claims psatoken.IClaims) (
func MatchSoftware(scheme string, evidence psatoken.IClaims, endorsements []handler.Endorsement) bool {
var attr SwAttr

evidenceComponents := make(map[string]psatoken.SwComponent)
evidenceComponents := make(map[string]psatoken.ISwComponent)
swComps, err := evidence.GetSoftwareComponents()
if err != nil {
return false
}
for _, c := range swComps {
key := base64.StdEncoding.EncodeToString(*c.MeasurementValue) + (*c.MeasurementType)
mval, err := c.GetMeasurementValue()
if err != nil {
return false
}
mtyp, err := c.GetMeasurementType()
if err != nil {
return false
}
key := base64.StdEncoding.EncodeToString(mval) + mtyp
evidenceComponents[key] = c
}
matched := false
Expand All @@ -131,10 +142,14 @@ func MatchSoftware(scheme string, evidence psatoken.IClaims, endorsements []hand
break
}

log.Debugf("MeasurementType Evidence: %s, Endorsement: %s", *evComp.MeasurementType, attr.MeasurementType)
typeMatched := attr.MeasurementType == "" || attr.MeasurementType == *evComp.MeasurementType
sigMatched := attr.SignerID == nil || bytes.Equal(attr.SignerID, *evComp.SignerID)
versionMatched := attr.Version == "" || attr.Version == *evComp.Version
evCompMeasurementType, _ := evComp.GetMeasurementType()
evCompSignerID, _ := evComp.GetSignerID()
evCompVersion, _ := evComp.GetVersion()

log.Debugf("MeasurementType Evidence: %s, Endorsement: %s", evCompMeasurementType, attr.MeasurementType)
typeMatched := attr.MeasurementType == "" || attr.MeasurementType == evCompMeasurementType
sigMatched := attr.SignerID == nil || bytes.Equal(attr.SignerID, evCompSignerID)
versionMatched := attr.Version == "" || attr.Version == evCompVersion

if !(typeMatched && sigMatched && versionMatched) {
matched = false
Expand Down Expand Up @@ -176,7 +191,7 @@ func GetPublicKeyFromTA(scheme string, trustAnchor string) (crypto.PublicKey, er
return pk, nil
}

func MatchPlatformConfig(scheme string, evidence psatoken.IClaims, endorsements []handler.Endorsement) bool {
func MatchPlatformConfig(scheme string, evidence platform.IClaims, endorsements []handler.Endorsement) bool {
var attr CcaPlatformCfg
pfConfig, err := evidence.GetConfig()
if err != nil {
Expand Down
10 changes: 6 additions & 4 deletions scheme/common/cca/realm/realm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"net/url"
"strings"

"github.com/veraison/ccatoken"
"github.com/veraison/ccatoken/realm"
"github.com/veraison/services/log"
)

Expand Down Expand Up @@ -72,15 +72,17 @@ func GetREMs(attr json.RawMessage) ([][]byte, error) {
return rems, nil
}

func MapToRealmClaims(in map[string]interface{}) (ccatoken.IClaims, error) {
realmClaims := &ccatoken.RealmClaims{}
func MapToRealmClaims(in map[string]interface{}) (realm.IClaims, error) {
data, err := json.Marshal(in)
if err != nil {
return nil, err
}
if err := realmClaims.FromJSON(data); err != nil {

realmClaims, err := realm.DecodeClaimsFromJSON(data)
if err != nil {
return nil, err
}

return realmClaims, nil
}

Expand Down
Loading

0 comments on commit ca7cb17

Please sign in to comment.