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 11, 2023
1 parent 1f88781 commit b77baee
Show file tree
Hide file tree
Showing 17 changed files with 1,221 additions and 1,122 deletions.
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
11 changes: 6 additions & 5 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{},
verifkey: CryptoKeys{},
testerr: "verification keys validation failed: no verification key 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 verification 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 b77baee

Please sign in to comment.