You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[BBS+ signature together with accumulator membership](#bbs-signature-together-with-accumulator-membership)
34
+
-[Getting a blind signature](#getting-a-blind-signature)
35
+
-[Verifier-local or opt-in linkability](#verifier-local-or-opt-in-linkability)
36
+
-[Social KYC](#social-kyc)
37
+
-[Verifiable encryption using SAVER](#verifiable-encryption-using-saver)
38
+
-[Bound check using LegoGroth16](#bound-check-using-legogroth16)
39
+
-[Optimization](#optimization)
40
+
6
41
## Getting started
7
42
8
43
To use this package within your project simply run
@@ -36,7 +71,7 @@ yarn test
36
71
## Overview
37
72
Following is a conceptual explanation of the primitives.
38
73
39
-
### BBS+ Signatures
74
+
### BBS+ Signature
40
75
BBS+ signature allow for signing an ordered list of messages, producing a signature of constant size independent of the number
41
76
of messages. The signer needs to have a public-private keypair and signature parameters which are public values whose size
42
77
depends on the number of messages being signed. A verifier who needs to verify the signature needs to know the
@@ -93,7 +128,7 @@ A typical use of accumulator looks like:
93
128
- Verifier can verify above proof using the current accumulator, the parameters and signer's public key and is convinced
94
129
that the user knows of an element and its witness and the (non)-membership.
95
130
96
-
### Composite proofs
131
+
### Composite proof
97
132
The above primitives can be combined using the composite proof system. An example is (in zero knowledge) proving knowledge of 2
98
133
different signatures and the message lists. Another example is proving knowledge of the signature and messages and certain message's presence (absence)
99
134
in an accumulator. Or the knowledge of 5 signatures and proving certain message is the same in the 5 message lists.
@@ -447,17 +482,18 @@ const witnesses = new Witnesses();
447
482
witnesses.add(witness1);
448
483
```
449
484
450
-
Prover now uses the `ProofSpec` to create the proof
485
+
Prover now uses the `ProofSpec` to create the proof. To ensure that the prover is not replaying, i.e. reusing a proof created by someone else, the verifier can request the prover to include its provided nonce in the proof.
`statement1` is the for proving knowledge of BBS+ signature as seen in previous examples. `statement2` is for proving the encryption of message from a
897
932
BBS+ signature. Some things to note about this statement.
898
-
- The statement is created using `Statement.saverProver` because it is being created by a prover. A verifier would have
933
+
934
+
- The statement is created using `Statement.saverProver` because it is being created by a prover. A verifier would have
899
935
used `Statement.saverVerifier` to create it and one of the arguments would be different (shown below).
900
-
- The argument `saverEncGens` is the encryption generators created by decryptor. However, before they are passed to `Statement.saverProver`,
901
-
the are uncompressed (ref. elliptic curve point compression) as shown in the above snippet. Uncompressing them doubles
902
-
their size but makes them faster to work with. However, if you still want to use the compressed parameters use `Statement.saverProverFromCompressedParams`
936
+
- The argument `saverEncGens` is the encryption generators created by decryptor. However, before they are passed to `Statement.saverProver`, the are uncompressed (ref. elliptic curve point compression) as shown in the above snippet. Uncompressing them doubles their size but makes them faster to work with. However, if you still want to use the compressed parameters use `Statement.saverProverFromCompressedParams`
903
937
-`saverEk` is the encryption key created by the decryptor during `setup` but is uncompressed.
904
938
-`snarkProvingKey` is the proving key created by the decryptor during `setup` but is uncompressed.
The above has a few differences from the prover's statements:
993
+
959
994
- Instead of using `Statement.saverProver`, verifier uses `Statement.saverVerifier`.
960
995
- Instead of proving key, verifier uses verifying key for the snark.
961
996
@@ -999,7 +1034,8 @@ A complete example as a test is [here](./tests/composite-proofs/bound-check.spec
999
1034
1000
1035
Allow a verifier to check that some attribute of the credential satisfies given bounds `min` and `max`, i.e. `min <= message <= max`
1001
1036
without learning the attribute itself. Both `min` and `max` are positive integers. This is implemented using LegoGroth16, a protocol described in the SNARK
1002
-
framework [Legosnark](https://eprint.iacr.org/2019/142) in appendix H.2
1037
+
framework [Legosnark](https://eprint.iacr.org/2019/142) in appendix H.2.
1038
+
To work with negative integers or decimal numbers, they must be converted to positive integers first and this conversion must happen before these are signed. When working with negative integers, add the absolute value of the smallest (negative) integer to all values including bounds. Eg, if the smallest negative number a value can be is -300, the signer should sign `value + 300` to ensure that values are always positive. During the bound check, say the verifier has to check if the value is between -200 and 50, the verifier should ask the prover to the bounds as 100 (-200 + 300) and 350 (50 + 300). When working with decimal numbers, convert them to integers by multiplying with a number to make it integer, like if a decimal value can have maximum of 3 decimal places, they should be multiplied by 1000. The test mentioned above shows these scenarios.
1003
1039
1004
1040
For this, the verifier needs to first create the setup parameters which he then shares with the prover. Note that the
1005
1041
verifier does not have to create them each time a proof needs to be verifier, it can create them once and publish somewhere
@@ -1012,8 +1048,7 @@ from lower and upper bound respectively.
1012
1048
const provingKey =BoundCheckSnarkSetup();
1013
1049
```
1014
1050
1015
-
For creating the proof of knowledge of the BBS+ signature and one of the signed message being in certain bounds, the prover
1016
-
creates the following 2 statements.
1051
+
For creating the proof of knowledge of the BBS+ signature and one of the signed message being in certain bounds, the prover creates the following 2 statements.
`statement1` is the for proving knowledge of BBS+ signature as seen in previous examples. `statement2` is for proving the
1037
-
bounds of message from a BBS+ signature. Some things to note about this statement.
1071
+
`statement1` is the for proving knowledge of BBS+ signature as seen in previous examples. `statement2` is for proving the bounds of message from a BBS+ signature. Some things to note about this statement.
1072
+
1038
1073
- The statement is created using `Statement.boundCheckProver` because it is being created by a prover. A verifier would have
1039
1074
used `Statement.boundCheckVerifier` to create it and one of the arguments would be different (shown below).
1040
-
-- The argument `snarkProvingKey` is the public parameter created by the verifier. However, before they are passed to `Statement.boundCheckProver`,
1041
-
the are uncompressed (ref. elliptic curve point compression) as shown in the above snippet. Uncompressing them doubles
1042
-
their size but makes them faster to work with. However, if you still want to use the compressed parameters use `Statement.boundCheckProverFromCompressedParams`
1075
+
- The argument `snarkProvingKey` is the public parameter created by the verifier. However, before they are passed to `Statement.boundCheckProver`, they are uncompressed (ref. elliptic curve point compression) as shown in the above snippet. Uncompressing them doubles their size but makes them faster to work with. However, if you still want to use the compressed parameters use `Statement.boundCheckProverFromCompressedParams`
1043
1076
1044
1077
The prover then establishes the equality between the message in the BBS+ signature and the bounded message by using
1045
1078
`WitnessEqualityMetaStatement` as below. `msgIdx` is the index of the bounded message in the array of signed messages
0 commit comments