-
Notifications
You must be signed in to change notification settings - Fork 24
/
signature_scheme.go
450 lines (420 loc) · 14.3 KB
/
signature_scheme.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
"crypto/ecdsa"
"sync"
"github.com/IBM/idemix/bccsp/types"
math "github.com/IBM/mathlib"
)
type SignatureScheme struct {
AuditNymEidStub func(types.IssuerPublicKey, int, []byte, string, *math.Zr, types.AuditVerificationType) error
auditNymEidMutex sync.RWMutex
auditNymEidArgsForCall []struct {
arg1 types.IssuerPublicKey
arg2 int
arg3 []byte
arg4 string
arg5 *math.Zr
arg6 types.AuditVerificationType
}
auditNymEidReturns struct {
result1 error
}
auditNymEidReturnsOnCall map[int]struct {
result1 error
}
AuditNymRhStub func(types.IssuerPublicKey, int, []byte, string, *math.Zr, types.AuditVerificationType) error
auditNymRhMutex sync.RWMutex
auditNymRhArgsForCall []struct {
arg1 types.IssuerPublicKey
arg2 int
arg3 []byte
arg4 string
arg5 *math.Zr
arg6 types.AuditVerificationType
}
auditNymRhReturns struct {
result1 error
}
auditNymRhReturnsOnCall map[int]struct {
result1 error
}
SignStub func([]byte, *math.Zr, *math.G1, *math.Zr, types.IssuerPublicKey, []types.IdemixAttribute, []byte, int, int, []byte, types.SignatureType, *types.IdemixSignerMetadata) ([]byte, *types.IdemixSignerMetadata, error)
signMutex sync.RWMutex
signArgsForCall []struct {
arg1 []byte
arg2 *math.Zr
arg3 *math.G1
arg4 *math.Zr
arg5 types.IssuerPublicKey
arg6 []types.IdemixAttribute
arg7 []byte
arg8 int
arg9 int
arg10 []byte
arg11 types.SignatureType
arg12 *types.IdemixSignerMetadata
}
signReturns struct {
result1 []byte
result2 *types.IdemixSignerMetadata
result3 error
}
signReturnsOnCall map[int]struct {
result1 []byte
result2 *types.IdemixSignerMetadata
result3 error
}
VerifyStub func(types.IssuerPublicKey, []byte, []byte, []types.IdemixAttribute, int, int, *ecdsa.PublicKey, int, types.VerificationType, *types.IdemixSignerMetadata) error
verifyMutex sync.RWMutex
verifyArgsForCall []struct {
arg1 types.IssuerPublicKey
arg2 []byte
arg3 []byte
arg4 []types.IdemixAttribute
arg5 int
arg6 int
arg7 *ecdsa.PublicKey
arg8 int
arg9 types.VerificationType
arg10 *types.IdemixSignerMetadata
}
verifyReturns struct {
result1 error
}
verifyReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *SignatureScheme) AuditNymEid(arg1 types.IssuerPublicKey, arg2 int, arg3 []byte, arg4 string, arg5 *math.Zr, arg6 types.AuditVerificationType) error {
var arg3Copy []byte
if arg3 != nil {
arg3Copy = make([]byte, len(arg3))
copy(arg3Copy, arg3)
}
fake.auditNymEidMutex.Lock()
ret, specificReturn := fake.auditNymEidReturnsOnCall[len(fake.auditNymEidArgsForCall)]
fake.auditNymEidArgsForCall = append(fake.auditNymEidArgsForCall, struct {
arg1 types.IssuerPublicKey
arg2 int
arg3 []byte
arg4 string
arg5 *math.Zr
arg6 types.AuditVerificationType
}{arg1, arg2, arg3Copy, arg4, arg5, arg6})
stub := fake.AuditNymEidStub
fakeReturns := fake.auditNymEidReturns
fake.recordInvocation("AuditNymEid", []interface{}{arg1, arg2, arg3Copy, arg4, arg5, arg6})
fake.auditNymEidMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4, arg5, arg6)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *SignatureScheme) AuditNymEidCallCount() int {
fake.auditNymEidMutex.RLock()
defer fake.auditNymEidMutex.RUnlock()
return len(fake.auditNymEidArgsForCall)
}
func (fake *SignatureScheme) AuditNymEidCalls(stub func(types.IssuerPublicKey, int, []byte, string, *math.Zr, types.AuditVerificationType) error) {
fake.auditNymEidMutex.Lock()
defer fake.auditNymEidMutex.Unlock()
fake.AuditNymEidStub = stub
}
func (fake *SignatureScheme) AuditNymEidArgsForCall(i int) (types.IssuerPublicKey, int, []byte, string, *math.Zr, types.AuditVerificationType) {
fake.auditNymEidMutex.RLock()
defer fake.auditNymEidMutex.RUnlock()
argsForCall := fake.auditNymEidArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6
}
func (fake *SignatureScheme) AuditNymEidReturns(result1 error) {
fake.auditNymEidMutex.Lock()
defer fake.auditNymEidMutex.Unlock()
fake.AuditNymEidStub = nil
fake.auditNymEidReturns = struct {
result1 error
}{result1}
}
func (fake *SignatureScheme) AuditNymEidReturnsOnCall(i int, result1 error) {
fake.auditNymEidMutex.Lock()
defer fake.auditNymEidMutex.Unlock()
fake.AuditNymEidStub = nil
if fake.auditNymEidReturnsOnCall == nil {
fake.auditNymEidReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.auditNymEidReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *SignatureScheme) AuditNymRh(arg1 types.IssuerPublicKey, arg2 int, arg3 []byte, arg4 string, arg5 *math.Zr, arg6 types.AuditVerificationType) error {
var arg3Copy []byte
if arg3 != nil {
arg3Copy = make([]byte, len(arg3))
copy(arg3Copy, arg3)
}
fake.auditNymRhMutex.Lock()
ret, specificReturn := fake.auditNymRhReturnsOnCall[len(fake.auditNymRhArgsForCall)]
fake.auditNymRhArgsForCall = append(fake.auditNymRhArgsForCall, struct {
arg1 types.IssuerPublicKey
arg2 int
arg3 []byte
arg4 string
arg5 *math.Zr
arg6 types.AuditVerificationType
}{arg1, arg2, arg3Copy, arg4, arg5, arg6})
stub := fake.AuditNymRhStub
fakeReturns := fake.auditNymRhReturns
fake.recordInvocation("AuditNymRh", []interface{}{arg1, arg2, arg3Copy, arg4, arg5, arg6})
fake.auditNymRhMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4, arg5, arg6)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *SignatureScheme) AuditNymRhCallCount() int {
fake.auditNymRhMutex.RLock()
defer fake.auditNymRhMutex.RUnlock()
return len(fake.auditNymRhArgsForCall)
}
func (fake *SignatureScheme) AuditNymRhCalls(stub func(types.IssuerPublicKey, int, []byte, string, *math.Zr, types.AuditVerificationType) error) {
fake.auditNymRhMutex.Lock()
defer fake.auditNymRhMutex.Unlock()
fake.AuditNymRhStub = stub
}
func (fake *SignatureScheme) AuditNymRhArgsForCall(i int) (types.IssuerPublicKey, int, []byte, string, *math.Zr, types.AuditVerificationType) {
fake.auditNymRhMutex.RLock()
defer fake.auditNymRhMutex.RUnlock()
argsForCall := fake.auditNymRhArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6
}
func (fake *SignatureScheme) AuditNymRhReturns(result1 error) {
fake.auditNymRhMutex.Lock()
defer fake.auditNymRhMutex.Unlock()
fake.AuditNymRhStub = nil
fake.auditNymRhReturns = struct {
result1 error
}{result1}
}
func (fake *SignatureScheme) AuditNymRhReturnsOnCall(i int, result1 error) {
fake.auditNymRhMutex.Lock()
defer fake.auditNymRhMutex.Unlock()
fake.AuditNymRhStub = nil
if fake.auditNymRhReturnsOnCall == nil {
fake.auditNymRhReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.auditNymRhReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *SignatureScheme) Sign(arg1 []byte, arg2 *math.Zr, arg3 *math.G1, arg4 *math.Zr, arg5 types.IssuerPublicKey, arg6 []types.IdemixAttribute, arg7 []byte, arg8 int, arg9 int, arg10 []byte, arg11 types.SignatureType, arg12 *types.IdemixSignerMetadata) ([]byte, *types.IdemixSignerMetadata, error) {
var arg1Copy []byte
if arg1 != nil {
arg1Copy = make([]byte, len(arg1))
copy(arg1Copy, arg1)
}
var arg6Copy []types.IdemixAttribute
if arg6 != nil {
arg6Copy = make([]types.IdemixAttribute, len(arg6))
copy(arg6Copy, arg6)
}
var arg7Copy []byte
if arg7 != nil {
arg7Copy = make([]byte, len(arg7))
copy(arg7Copy, arg7)
}
var arg10Copy []byte
if arg10 != nil {
arg10Copy = make([]byte, len(arg10))
copy(arg10Copy, arg10)
}
fake.signMutex.Lock()
ret, specificReturn := fake.signReturnsOnCall[len(fake.signArgsForCall)]
fake.signArgsForCall = append(fake.signArgsForCall, struct {
arg1 []byte
arg2 *math.Zr
arg3 *math.G1
arg4 *math.Zr
arg5 types.IssuerPublicKey
arg6 []types.IdemixAttribute
arg7 []byte
arg8 int
arg9 int
arg10 []byte
arg11 types.SignatureType
arg12 *types.IdemixSignerMetadata
}{arg1Copy, arg2, arg3, arg4, arg5, arg6Copy, arg7Copy, arg8, arg9, arg10Copy, arg11, arg12})
stub := fake.SignStub
fakeReturns := fake.signReturns
fake.recordInvocation("Sign", []interface{}{arg1Copy, arg2, arg3, arg4, arg5, arg6Copy, arg7Copy, arg8, arg9, arg10Copy, arg11, arg12})
fake.signMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}
func (fake *SignatureScheme) SignCallCount() int {
fake.signMutex.RLock()
defer fake.signMutex.RUnlock()
return len(fake.signArgsForCall)
}
func (fake *SignatureScheme) SignCalls(stub func([]byte, *math.Zr, *math.G1, *math.Zr, types.IssuerPublicKey, []types.IdemixAttribute, []byte, int, int, []byte, types.SignatureType, *types.IdemixSignerMetadata) ([]byte, *types.IdemixSignerMetadata, error)) {
fake.signMutex.Lock()
defer fake.signMutex.Unlock()
fake.SignStub = stub
}
func (fake *SignatureScheme) SignArgsForCall(i int) ([]byte, *math.Zr, *math.G1, *math.Zr, types.IssuerPublicKey, []types.IdemixAttribute, []byte, int, int, []byte, types.SignatureType, *types.IdemixSignerMetadata) {
fake.signMutex.RLock()
defer fake.signMutex.RUnlock()
argsForCall := fake.signArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7, argsForCall.arg8, argsForCall.arg9, argsForCall.arg10, argsForCall.arg11, argsForCall.arg12
}
func (fake *SignatureScheme) SignReturns(result1 []byte, result2 *types.IdemixSignerMetadata, result3 error) {
fake.signMutex.Lock()
defer fake.signMutex.Unlock()
fake.SignStub = nil
fake.signReturns = struct {
result1 []byte
result2 *types.IdemixSignerMetadata
result3 error
}{result1, result2, result3}
}
func (fake *SignatureScheme) SignReturnsOnCall(i int, result1 []byte, result2 *types.IdemixSignerMetadata, result3 error) {
fake.signMutex.Lock()
defer fake.signMutex.Unlock()
fake.SignStub = nil
if fake.signReturnsOnCall == nil {
fake.signReturnsOnCall = make(map[int]struct {
result1 []byte
result2 *types.IdemixSignerMetadata
result3 error
})
}
fake.signReturnsOnCall[i] = struct {
result1 []byte
result2 *types.IdemixSignerMetadata
result3 error
}{result1, result2, result3}
}
func (fake *SignatureScheme) Verify(arg1 types.IssuerPublicKey, arg2 []byte, arg3 []byte, arg4 []types.IdemixAttribute, arg5 int, arg6 int, arg7 *ecdsa.PublicKey, arg8 int, arg9 types.VerificationType, arg10 *types.IdemixSignerMetadata) error {
var arg2Copy []byte
if arg2 != nil {
arg2Copy = make([]byte, len(arg2))
copy(arg2Copy, arg2)
}
var arg3Copy []byte
if arg3 != nil {
arg3Copy = make([]byte, len(arg3))
copy(arg3Copy, arg3)
}
var arg4Copy []types.IdemixAttribute
if arg4 != nil {
arg4Copy = make([]types.IdemixAttribute, len(arg4))
copy(arg4Copy, arg4)
}
fake.verifyMutex.Lock()
ret, specificReturn := fake.verifyReturnsOnCall[len(fake.verifyArgsForCall)]
fake.verifyArgsForCall = append(fake.verifyArgsForCall, struct {
arg1 types.IssuerPublicKey
arg2 []byte
arg3 []byte
arg4 []types.IdemixAttribute
arg5 int
arg6 int
arg7 *ecdsa.PublicKey
arg8 int
arg9 types.VerificationType
arg10 *types.IdemixSignerMetadata
}{arg1, arg2Copy, arg3Copy, arg4Copy, arg5, arg6, arg7, arg8, arg9, arg10})
stub := fake.VerifyStub
fakeReturns := fake.verifyReturns
fake.recordInvocation("Verify", []interface{}{arg1, arg2Copy, arg3Copy, arg4Copy, arg5, arg6, arg7, arg8, arg9, arg10})
fake.verifyMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *SignatureScheme) VerifyCallCount() int {
fake.verifyMutex.RLock()
defer fake.verifyMutex.RUnlock()
return len(fake.verifyArgsForCall)
}
func (fake *SignatureScheme) VerifyCalls(stub func(types.IssuerPublicKey, []byte, []byte, []types.IdemixAttribute, int, int, *ecdsa.PublicKey, int, types.VerificationType, *types.IdemixSignerMetadata) error) {
fake.verifyMutex.Lock()
defer fake.verifyMutex.Unlock()
fake.VerifyStub = stub
}
func (fake *SignatureScheme) VerifyArgsForCall(i int) (types.IssuerPublicKey, []byte, []byte, []types.IdemixAttribute, int, int, *ecdsa.PublicKey, int, types.VerificationType, *types.IdemixSignerMetadata) {
fake.verifyMutex.RLock()
defer fake.verifyMutex.RUnlock()
argsForCall := fake.verifyArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5, argsForCall.arg6, argsForCall.arg7, argsForCall.arg8, argsForCall.arg9, argsForCall.arg10
}
func (fake *SignatureScheme) VerifyReturns(result1 error) {
fake.verifyMutex.Lock()
defer fake.verifyMutex.Unlock()
fake.VerifyStub = nil
fake.verifyReturns = struct {
result1 error
}{result1}
}
func (fake *SignatureScheme) VerifyReturnsOnCall(i int, result1 error) {
fake.verifyMutex.Lock()
defer fake.verifyMutex.Unlock()
fake.VerifyStub = nil
if fake.verifyReturnsOnCall == nil {
fake.verifyReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.verifyReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *SignatureScheme) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.auditNymEidMutex.RLock()
defer fake.auditNymEidMutex.RUnlock()
fake.auditNymRhMutex.RLock()
defer fake.auditNymRhMutex.RUnlock()
fake.signMutex.RLock()
defer fake.signMutex.RUnlock()
fake.verifyMutex.RLock()
defer fake.verifyMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *SignatureScheme) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ types.SignatureScheme = new(SignatureScheme)