From 93ffa3b36b4db65937959d3380b2ed5da50329ca Mon Sep 17 00:00:00 2001 From: Mathias Gibbens Date: Thu, 4 Sep 2025 21:56:38 +0000 Subject: [PATCH] fxamacker/cbor 2.9.0 changed some of its error messages Signed-off-by: Mathias Gibbens --- conformance_test.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- headers_test.go | 4 ++-- key_test.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conformance_test.go b/conformance_test.go index e95f46d..85f59f9 100644 --- a/conformance_test.go +++ b/conformance_test.go @@ -84,8 +84,8 @@ var testCases = []struct { {name: "sign1-verify-0007"}, // EdDSA Ed25519 {name: "sign1-verify-negative-0000", err: "cbor: invalid protected header: cbor: require bstr type"}, {name: "sign1-verify-negative-0001", err: "cbor: invalid protected header: cbor: protected header: require map type"}, - {name: "sign1-verify-negative-0002", err: "cbor: invalid protected header: cbor: found duplicate map key \"1\" at map element index 1"}, - {name: "sign1-verify-negative-0003", err: "cbor: invalid unprotected header: cbor: found duplicate map key \"4\" at map element index 1"}, + {name: "sign1-verify-negative-0002", err: "cbor: invalid protected header: cbor: found duplicate map key cose.headerLabelValidator{value:1} at map element index 1"}, + {name: "sign1-verify-negative-0003", err: "cbor: invalid unprotected header: cbor: found duplicate map key cose.headerLabelValidator{value:4} at map element index 1"}, {name: "sign1-verify-negative-0004"}, // EdDSA Ed25519 invalid signature } diff --git a/go.mod b/go.mod index fad879c..a69cb2d 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/veraison/go-cose go 1.21 -require github.com/fxamacker/cbor/v2 v2.5.0 +require github.com/fxamacker/cbor/v2 v2.9.0 require github.com/x448/float16 v0.8.4 // indirect diff --git a/go.sum b/go.sum index 0f986a9..17d585a 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ -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/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= diff --git a/headers_test.go b/headers_test.go index b9a09dc..55c0324 100644 --- a/headers_test.go +++ b/headers_test.go @@ -372,7 +372,7 @@ func TestProtectedHeader_UnmarshalCBOR(t *testing.T) { data: []byte{ 0x45, 0xa2, 0x01, 0x00, 0x01, 0x00, }, - wantErr: "cbor: found duplicate map key \"1\" at map element index 1", + wantErr: "cbor: found duplicate map key cose.headerLabelValidator{value:1} at map element index 1", }, { name: "incomplete CBOR data", @@ -1078,7 +1078,7 @@ func TestUnprotectedHeader_UnmarshalCBOR(t *testing.T) { data: []byte{ 0xa2, 0x01, 0x00, 0x01, 0x00, }, - wantErr: "cbor: found duplicate map key \"1\" at map element index 1", + wantErr: "cbor: found duplicate map key cose.headerLabelValidator{value:1} at map element index 1", }, { name: "incomplete CBOR data", diff --git a/key_test.go b/key_test.go index 6e5ee0c..309cedc 100644 --- a/key_test.go +++ b/key_test.go @@ -340,7 +340,7 @@ func TestKey_UnmarshalCBOR(t *testing.T) { 0x18, 0x66, 0x18, 0x47, // 66: 47 }, want: nil, - wantErr: `cbor: found duplicate map key "102" at map element index 2`, + wantErr: `cbor: found duplicate map key 102 at map element index 2`, }, { name: "duplicated kty", data: []byte{ @@ -350,7 +350,7 @@ func TestKey_UnmarshalCBOR(t *testing.T) { 0x01, 0x01, // kty: OKP (duplicated) }, want: nil, - wantErr: `cbor: found duplicate map key "1" at map element index 2`, + wantErr: `cbor: found duplicate map key 1 at map element index 2`, }, { name: "OKP missing curve", data: []byte{