-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
337 lines (277 loc) · 14.4 KB
/
main_test.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
package main
import (
"fmt"
"github.com/minvws/nl-covid19-coronacheck-idemix/common"
"math"
"reflect"
"strconv"
"testing"
"time"
"github.com/go-errors/errors"
"github.com/minvws/nl-covid19-coronacheck-idemix/common/pool"
"github.com/minvws/nl-covid19-coronacheck-idemix/holder"
"github.com/minvws/nl-covid19-coronacheck-idemix/issuer"
"github.com/minvws/nl-covid19-coronacheck-idemix/issuer/localsigner"
"github.com/minvws/nl-covid19-coronacheck-idemix/verifier"
"github.com/privacybydesign/gabi"
"github.com/privacybydesign/gabi/big"
gabipool "github.com/privacybydesign/gabi/pool"
)
var testKID = "testPk"
var testKeyUsage = "dynamic"
type TB interface {
Fatal(args ...interface{})
}
func TestCredentialVersion2(t *testing.T) {
testIssuanceDisclosureVerificationFlow(t, 2, holder.CATEGORY_DISCLOSED_V2_SERIALIZATION)
testIssuanceDisclosureVerificationFlow(t, 2, holder.CATEGORY_DISCLOSED_V3_SERIALIZATION)
testStaticIssuanceFlow(t, 2)
}
func TestCredentialVersion3(t *testing.T) {
testIssuanceDisclosureVerificationFlow(t, 3, holder.CATEGORY_DISCLOSED_V2_SERIALIZATION)
testIssuanceDisclosureVerificationFlow(t, 3, holder.CATEGORY_DISCLOSED_V3_SERIALIZATION)
testStaticIssuanceFlow(t, 3)
}
func TestHideCategory(t *testing.T) {
testIssuanceDisclosureVerificationFlow(t, 3, holder.CATEGORY_HIDDEN)
}
func testIssuanceDisclosureVerificationFlow(t *testing.T, credentialVersion int, categoryMode int) {
credentialAmount := 3
iss, h, holderSk, v := createIHV(t, credentialVersion, true)
// Ask for some extra commitments
extraCommitments := 7
// Issuance dance
pim, err := iss.PrepareIssue(&issuer.PrepareIssueRequestMessage{
CredentialAmount: credentialAmount + extraCommitments,
KeyUsage: testKeyUsage,
})
if err != nil {
t.Fatal("Could not get prepareIssueMessage:", err.Error())
}
credBuilders, icm, err := h.CreateCommitments(holderSk, pim)
if err != nil {
t.Fatal("Could not create credential commitments:", err.Error())
}
credentialsAttributes := buildCredentialsAttributes(credentialAmount, credentialVersion)
im := &issuer.IssueMessage{
PrepareIssueMessage: pim,
IssueCommitmentMessage: icm,
CredentialsAttributes: credentialsAttributes,
CredentialVersion: credentialVersion,
KeyUsage: testKeyUsage,
}
ccms, err := iss.Issue(im)
if err != nil {
t.Fatal("Could not issue credentials:", err.Error())
}
disclosureTime := time.Now().Unix()
creds, err := h.CreateCredentials(credBuilders, ccms)
if err != nil {
t.Fatal("Could not create credentials:", err.Error())
}
for i := 0; i < credentialAmount; i++ {
// Read
readAttributes, credVersion, err := h.ReadCredential(creds[i])
if err != nil {
t.Fatal("Could not read credential:", err.Error())
}
// Check
if credVersion != credentialVersion {
t.Fatal("Incorrect credential version:", credVersion)
}
if !reflect.DeepEqual(credentialsAttributes[i], readAttributes) {
t.Fatal("Read attributes are not the same as those issued")
}
// Disclose
qr, proofIdentifier, err := h.DiscloseWithTimeQREncoded(holderSk, creds[i], categoryMode, time.Now())
if err != nil {
t.Fatal("Could not disclosure credential:", err.Error())
}
// Verify
verifiedCred, err := v.VerifyQREncoded(qr)
if err != nil {
t.Fatal("Could not verify disclosed credential:", err.Error())
}
if categoryMode == holder.CATEGORY_HIDDEN {
delete(credentialsAttributes[i], "category")
}
if !reflect.DeepEqual(credentialsAttributes[i], verifiedCred.Attributes) {
t.Fatal("Verified attributes are not the same as those issued")
}
if !reflect.DeepEqual(verifiedCred.ProofIdentifier, proofIdentifier) {
t.Fatal("Proof identifier of verified QR didn't match the one at issuance")
}
secondsDifference := int(math.Abs(float64(verifiedCred.DisclosureTimeSeconds - disclosureTime)))
if secondsDifference > 5 {
t.Fatal("Invalid verified disclosure time (or your test machine is really slow):", secondsDifference)
}
if verifiedCred.IssuerPkId != testKID {
t.Fatal("Incorrect issuer public key id:", verifiedCred.IssuerPkId)
}
if verifiedCred.CredentialVersion != credentialVersion {
t.Fatal("Incorrect credential version:", verifiedCred.CredentialVersion)
}
}
}
func testStaticIssuanceFlow(t *testing.T, credentialVersion int) {
iss, _, _, v := createIHV(t, credentialVersion, false)
attrs := buildCredentialsAttributes(1, credentialVersion)[0]
attrs["isPaperProof"] = "1"
attrs["validForHours"] = "2016"
proofPrefixed, proofIdentifier, err := iss.IssueStatic(&issuer.StaticIssueMessage{
CredentialAttributes: attrs,
CredentialVersion: credentialVersion,
KeyUsage: testKeyUsage,
})
if err != nil {
t.Fatal("Could not issue static credential", err.Error())
}
verifiedCred, err := v.VerifyQREncoded(proofPrefixed)
if err != nil {
t.Fatal("Could not verify freshly issues static credential", err.Error())
}
if !reflect.DeepEqual(attrs, verifiedCred.Attributes) {
t.Fatal("Verified attributes are not the same as those issued statically")
}
if !reflect.DeepEqual(verifiedCred.ProofIdentifier, proofIdentifier) {
t.Fatal("Proof identifier of verified QR didn't match the one at issuance")
}
}
func TestPreviousDisclosureImplementation(t *testing.T) {
qrs := []string{
"NL2:SJQZYV54X%7B LY2JZE7O962F:MUE*0/*D8SBS4$2:+ Y$ISBID/HE*$ EM3/VFLO%+TRG8598%0T0H16HA5+S:- 6L/Q+VKI5P-Y%CO/QPX4+2FX8Q9XW88KEHJB*JD/SAGWW$S8Q7N:3Q7JPU/I6-QQ+GGG3J5N$8-8Q* S430CV8LHYU6VUZQ4C*5WGGAMCV P.$I-MT4DIMM-ZZ+F.ABQ63.ZT%S8BXB.MF9DEZVCV:8F/SC0LIS.OG5-+5+FGAC5BDT%FE T0RG.3NM5-.65Y%+CAIGUBC-PDMGWW/W-K8O4BT02BDC8T$2 O$0M681+P8Z:W02R-I-Q-TAQ%-$RM2B%QR5-3Y9L$$1G0+BTD782RCWFRY107BEW1$-314QRMG2LSDSQTU--3OC*64VLNZ H63Z-BZ :NQRREBE1$OUSF-Q2D/O.MT+KRM3XV+5*V6$GH3I//WH3XP*X3WZ /EV--HJ 3J0ORVP6PAA9113YJ-YG:7EWR$06IFHG$MH82-T55.BE9LG-7XUX0C1VY2N0ABX:OIW8+2B.4Y 09:MC3A03AH3URRO3R+5Z04BVTES9Y$CY2*Z18GO+4VJRFE61D8LOUB/FO0T071LW O*9J $$N$Q$.2R1Q-G0R. T84WA%-D2RO%9UXFSX0B:UA1QJ5$%7RBZQ9V/N0$K2:/O3KGFKKMQCEUU8S/TX-%OHUJD1WT$BSZD604L8MW77KWJZ8IUE:$NIYBEMIJN0BO/I32-NU4LSSANHKJXL0KMZCE%4W5LNL/RCKORW-7WZ%ITUZ+TDS++AR4TP99L5PU*H30KB7O5LD%T8K1V1JBSEAQO2F0R0:YYULFOP 7CP4V8KZ/1S/.Y%XR9E4VM3ABH7-$:$%R GX77I6Y+LBD6.W/0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NXYET2.DT4N4S A*6WO0471YWSE$IQ:8BZ3X$TGI1+.%OWHSF 9%D7MSTS0X2JL0OVJJ1*N3L8O.BX:Q2G:TN1DHX:7UA2%KM/44E8B6BLW+-.D921BFZ9RB61%Y%C+T:PAUQFWD:F7SQBZBB Y5A%UZ5TG6C6*15ZB9KP",
}
_, _, _, v := createIHV(t, -1, false)
for i, qr := range qrs {
_, err := v.VerifyQREncoded([]byte(qr))
if err != nil {
t.Fatalf("Couldn't verify previous disclosure QR #%d\n", i)
}
}
}
func BenchmarkIssueStatic(b *testing.B) {
iss, _, _, _ := createIHV(b, 3, false)
sim := &issuer.StaticIssueMessage{
CredentialAttributes: buildCredentialsAttributes(1, 3)[0],
CredentialVersion: 3,
KeyUsage: testKeyUsage,
}
for i := 0; i < b.N; i++ {
_, _, err := iss.IssueStatic(sim)
if err != nil {
b.Fatal("Could not issue static credential for benchmarking", err.Error())
}
}
}
func benchmarkIssueMultiple(b *testing.B, withPrimePool bool) {
iss, hldr, _, _ := createIHV(b, 3, withPrimePool)
credentialAmount := 32
holderSk := holder.GenerateSk()
pim, err := iss.PrepareIssue(&issuer.PrepareIssueRequestMessage{
KeyUsage: testKeyUsage,
CredentialAmount: credentialAmount,
})
if err != nil {
b.Fatal("Could not create prepare issue message", err.Error())
}
_, icm, err := hldr.CreateCommitments(holderSk, pim)
if err != nil {
b.Fatal("Could not create commitments", err.Error())
}
im := &issuer.IssueMessage{
PrepareIssueMessage: pim,
IssueCommitmentMessage: icm,
CredentialsAttributes: buildCredentialsAttributes(32, 3),
CredentialVersion: 3,
KeyUsage: testKeyUsage,
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := iss.Issue(im)
if err != nil {
b.Fatal("Could not issue credentials for benchmarking", err.Error())
}
}
}
func BenchmarkIssueMultiple(b *testing.B) {
benchmarkIssueMultiple(b, false)
}
func BenchmarkIssueMemoryPool(b *testing.B) {
benchmarkIssueMultiple(b, true)
}
func buildCredentialsAttributes(credentialAmount int, credentialVersion int) []map[string]string {
cas := make([]map[string]string, 0, credentialAmount)
for i := 0; i < credentialAmount; i++ {
validFrom := time.Now().Round(time.Hour).AddDate(0, 0, i).UTC().Unix()
ca := map[string]string{
"isSpecimen": "0",
"isPaperProof": "0",
"validFrom": strconv.FormatInt(validFrom, 10),
"validForHours": "24",
"firstNameInitial": "A",
"lastNameInitial": "R",
"birthDay": "20",
"birthMonth": "10",
}
if credentialVersion == 3 {
ca["category"] = "1"
}
cas = append(cas, ca)
}
return cas
}
func createIHV(t TB, credentialVersion int, withPrimePool bool) (*issuer.Issuer, *holder.Holder, *big.Int, *verifier.Verifier) {
iss := createIssuer(t, withPrimePool)
pk, _, _ := iss.Signer.FindIssuerPk(&localsigner.KeySpecification{
KeyUsage: testKeyUsage,
})
h, holderSk := createHolder(pk, credentialVersion)
v := createVerifier(pk)
return iss, h, holderSk, v
}
func createIssuer(t TB, withPrimePool bool) *issuer.Issuer {
var primePool gabipool.PrimePool
if withPrimePool {
fmt.Println("Prefilling memory pool...")
primePool = pool.NewMemoryPool(101, 10, 100, 644, 119, -1)
for !primePool.(*pool.MemoryPool).IsFull() {
time.Sleep(100 * time.Millisecond)
}
fmt.Println("Memory pool warmup completed")
} else {
primePool = gabipool.NewRandomPool()
}
pks := []*localsigner.Key{
{
KeyUsage: testKeyUsage,
KeyIdentifier: testKID,
PkPath: "./testdata/pk.xml",
SkPath: "./testdata/sk.xml",
},
}
ls, err := localsigner.New(pks, primePool)
if err != nil {
t.Fatal("Could not create signer:", err.Error())
}
return issuer.New(ls)
}
func createHolder(pk *gabi.PublicKey, credentialVersion int) (*holder.Holder, *big.Int) {
holderSk := holder.GenerateSk()
findIssuerPk := buildFindIssuerPkFunc(testKID, pk)
return holder.New(findIssuerPk, credentialVersion), holderSk
}
func createVerifier(pk *gabi.PublicKey) *verifier.Verifier {
findIssuerPk := buildFindIssuerPkFunc(testKID, pk)
return verifier.New(findIssuerPk)
}
func buildFindIssuerPkFunc(kid string, pk *gabi.PublicKey) common.FindIssuerPkFunc {
return func(askedKID string) (*gabi.PublicKey, error) {
if askedKID != kid {
return nil, errors.Errorf("Invalid kid passed test function")
}
return pk, nil
}
}