Skip to content

Commit

Permalink
comid: implement Crypto Keys
Browse files Browse the repository at this point in the history
Implement Crypto Keys as described by section 3.1.4.1.6 of
draft-ietf-rats-corim-02:

https://www.ietf.org/archive/id/draft-ietf-rats-corim-02.html#name-crypto-keys

The replaces the equivalent VerifKey construct in the existing
implementation. Crypo Keys are one of pre-defined types, allowing for
stronger validation of the underlying value.

As part of this change, the dependency on swid library is updated to the
most current version, which changes the representation of digests to use
";" instead of ":" as the separator.

Signed-off-by: Sergei Trofimov <[email protected]>
  • Loading branch information
setrofim committed Sep 12, 2023
1 parent 4260ef3 commit 3bcfc38
Show file tree
Hide file tree
Showing 21 changed files with 1,410 additions and 1,153 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-go-cover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.17.2"
go-version: "1.18"
- name: Checkout code
uses: actions/checkout@v2
- name: Install mockgen
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.17.2"
go-version: "1.18"
- name: Checkout code
uses: actions/checkout@v2
- name: Install golangci-lint
Expand All @@ -19,7 +19,7 @@ jobs:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2
- name: Install mockgen
run: |
go install github.com/golang/mock/[email protected]
go install github.com/golang/mock/[email protected]
- name: Run required linters in .golangci.yml plus hard-coded ones here
run: make lint
- name: Run optional linters (not required to pass)
Expand Down
2 changes: 1 addition & 1 deletion comid/attestverifkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
type AttestVerifKey struct {
_ struct{} `cbor:",toarray"`
Environment Environment `json:"environment"`
VerifKeys VerifKeys `json:"verification-keys"`
VerifKeys CryptoKeys `json:"verification-keys"`
}

func (o AttestVerifKey) Valid() error {
Expand Down
13 changes: 7 additions & 6 deletions comid/attestverifkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@ import (
)

func TestAttestVerifKey_Valid_empty(t *testing.T) {
invalidKey := CryptoKey{TaggedPKIXBase64Key("")}

tvs := []struct {
env Environment
verifkey VerifKeys
verifkey CryptoKeys
testerr string
}{
{
env: Environment{},
verifkey: VerifKeys{},
verifkey: CryptoKeys{},
testerr: "environment validation failed: environment must not be empty",
},
{
env: Environment{Instance: NewInstanceUEID(TestUEID)},
verifkey: VerifKeys{},
testerr: "verification keys validation failed: no verification key to validate",
verifkey: CryptoKeys{},
testerr: "verification keys validation failed: no keys to validate",
},
{
env: Environment{Instance: NewInstanceUEID(TestUEID)},
verifkey: VerifKeys{{Key: ""}},
testerr: "verification keys validation failed: invalid verification key at index 0: verification key not set",
verifkey: CryptoKeys{&invalidKey},
testerr: "verification keys validation failed: invalid key at index 0: key value not set",
},
}
for _, tv := range tvs {
Expand Down
7 changes: 7 additions & 0 deletions comid/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ func comidTags() cbor.TagSet {
//551: To Do see: https://github.com/veraison/corim/issues/32
552: TaggedSVN(0),
553: TaggedMinSVN(0),
554: TaggedPKIXBase64Key(""),
555: TaggedPKIXBase64Cert(""),
556: TaggedPKIXBase64CertPath(""),
557: TaggedThumbprint{},
558: TaggedCOSEKey{},
559: TaggedCertThumbprint{},
560: TaggedRawValueBytes{},
561: TaggedCertPathThumbprint{},
// PSA profile tags
600: TaggedImplID{},
601: TaggedPSARefValID{},
Expand Down
Loading

0 comments on commit 3bcfc38

Please sign in to comment.