@@ -41,11 +41,11 @@ func TestPAE(t *testing.T) {
41
41
42
42
type nilSignerVerifier int
43
43
44
- func (n nilSignerVerifier ) Sign (ctx context.Context , data []byte ) ([]byte , error ) {
44
+ func (n nilSignerVerifier ) Sign (_ context.Context , data []byte ) ([]byte , error ) {
45
45
return data , nil
46
46
}
47
47
48
- func (n nilSignerVerifier ) Verify (ctx context.Context , data , sig []byte ) error {
48
+ func (n nilSignerVerifier ) Verify (_ context.Context , data , sig []byte ) error {
49
49
if len (data ) != len (sig ) {
50
50
return errLength
51
51
}
@@ -69,11 +69,11 @@ func (n nilSignerVerifier) Public() crypto.PublicKey {
69
69
70
70
type nullSignerVerifier int
71
71
72
- func (n nullSignerVerifier ) Sign (ctx context.Context , data []byte ) ([]byte , error ) {
72
+ func (n nullSignerVerifier ) Sign (_ context.Context , data []byte ) ([]byte , error ) {
73
73
return data , nil
74
74
}
75
75
76
- func (n nullSignerVerifier ) Verify (ctx context.Context , data , sig []byte ) error {
76
+ func (n nullSignerVerifier ) Verify (_ context.Context , data , sig []byte ) error {
77
77
if len (data ) != len (sig ) {
78
78
return errLength
79
79
}
@@ -97,11 +97,11 @@ func (n nullSignerVerifier) Public() crypto.PublicKey {
97
97
98
98
type errsigner int
99
99
100
- func (n errsigner ) Sign (ctx context.Context , data []byte ) ([]byte , error ) {
100
+ func (n errsigner ) Sign (_ context.Context , _ []byte ) ([]byte , error ) {
101
101
return nil , fmt .Errorf ("signing error" )
102
102
}
103
103
104
- func (n errsigner ) Verify (ctx context.Context , data , sig []byte ) error {
104
+ func (n errsigner ) Verify (_ context.Context , _ , _ []byte ) error {
105
105
return errVerify
106
106
}
107
107
@@ -118,11 +118,11 @@ type errSignerVerifier int
118
118
var errVerify = fmt .Errorf ("accepted signatures do not match threshold, Found: 0, Expected 1" )
119
119
var errThreshold = fmt .Errorf ("invalid threshold" )
120
120
121
- func (n errSignerVerifier ) Sign (ctx context.Context , data []byte ) ([]byte , error ) {
121
+ func (n errSignerVerifier ) Sign (_ context.Context , data []byte ) ([]byte , error ) {
122
122
return data , nil
123
123
}
124
124
125
- func (n errSignerVerifier ) Verify (ctx context.Context , data , sig []byte ) error {
125
+ func (n errSignerVerifier ) Verify (_ context.Context , _ , _ []byte ) error {
126
126
return errVerify
127
127
}
128
128
@@ -136,12 +136,11 @@ func (n errSignerVerifier) Public() crypto.PublicKey {
136
136
137
137
type badverifier int
138
138
139
- func (n badverifier ) Sign (ctx context.Context , data []byte ) ([]byte , error ) {
139
+ func (n badverifier ) Sign (_ context.Context , data []byte ) ([]byte , error ) {
140
140
return append (data , byte (0 )), nil
141
141
}
142
142
143
- func (n badverifier ) Verify (ctx context.Context , data , sig []byte ) error {
144
-
143
+ func (n badverifier ) Verify (_ context.Context , data , sig []byte ) error {
145
144
if len (data ) != len (sig ) {
146
145
return errLength
147
146
}
@@ -186,7 +185,7 @@ func TestNilSign(t *testing.T) {
186
185
187
186
pae := PAE (payloadType , payload )
188
187
want := Envelope {
189
- Payload : base64 .StdEncoding .EncodeToString ([] byte ( payload ) ),
188
+ Payload : base64 .StdEncoding .EncodeToString (payload ),
190
189
PayloadType : payloadType ,
191
190
Signatures : []Signature {
192
191
{
@@ -200,7 +199,7 @@ func TestNilSign(t *testing.T) {
200
199
signer , err := NewEnvelopeSigner (ns )
201
200
assert .Nil (t , err , "unexpected error" )
202
201
203
- got , err := signer .SignPayload (context .TODO (), payloadType , [] byte ( payload ) )
202
+ got , err := signer .SignPayload (context .TODO (), payloadType , payload )
204
203
assert .Nil (t , err , "sign failed" )
205
204
assert .Equal (t , & want , got , "bad signature" )
206
205
}
@@ -253,7 +252,7 @@ type ecdsaSignerVerifier struct {
253
252
verified bool
254
253
}
255
254
256
- func (es * ecdsaSignerVerifier ) Sign (ctx context.Context , data []byte ) ([]byte , error ) {
255
+ func (es * ecdsaSignerVerifier ) Sign (_ context.Context , data []byte ) ([]byte , error ) {
257
256
// Data is complete message, hash it and sign the digest
258
257
digest := sha256 .Sum256 (data )
259
258
r , s , err := rfc6979 .SignECDSA (es .key , digest [:], sha256 .New )
@@ -264,12 +263,12 @@ func (es *ecdsaSignerVerifier) Sign(ctx context.Context, data []byte) ([]byte, e
264
263
rb := r .Bytes ()
265
264
sb := s .Bytes ()
266
265
es .rLen = len (rb )
267
- rawSig := append (rb , sb ... )
266
+ rawSig := append (rb , sb ... ) //nolint:gocritic
268
267
269
268
return rawSig , nil
270
269
}
271
270
272
- func (es * ecdsaSignerVerifier ) Verify (ctx context.Context , data , sig []byte ) error {
271
+ func (es * ecdsaSignerVerifier ) Verify (_ context.Context , data , sig []byte ) error {
273
272
var r big.Int
274
273
var s big.Int
275
274
digest := sha256 .Sum256 (data )
0 commit comments