Proving You Have a Positive Value Without Revealing It

Our data world needs to change, and for it not to reveal our most precious of secrets. This results in proving proofs of knowledge, and…

Photo by Jeremy Perkins on Unsplash

Proving You Have a Positive Value Without Revealing It

Our data world needs to change, and for it not to reveal our most precious of secrets. This results in proving proofs of knowledge, and where we do not reveal our data, but a proof of it. One thing we might do, is to prove that we have a positive value, without revealing the value. This might relate to our bank balance, and a proof that it is in a positive state. So, let’s look at a method that does a proof of knowledge that a value is greater than zero.

With the Damgard-Fujisaki method, Peggy proves to Victor that she has a positive integer value, and using the secp256k1 curve. In this case we will use the Damgard-Fujisaki method defined [here], and where Peggy has to prove to Victor that she has a positive value:

First Victor and Peggy agree on two bases for their calculations (g and h) and a prime number (n). Victor then sends Peggy using a random number (r) as a challenge. Every positive value can be represented in the form:

For example:

Peggy now creates four commitments from these four values, and takes four random numbers (r0, r1, r2 and r3).

And:

Victor then checks:

And this should be equal to:

The implementation is here:

https://asecuritysite.com/zero/z_df2

Converting to ECC

We start with two points on the curve: G and H. And then can compute:

and then:

Victor then checks:

and check than this equals:

The following is some simple coding to prove the method [here]:

A sample run is [here]:

x=524287, x0= 1, x1=723, x2=39, x3=6
524287 = 1^2+723^2+39^2+6^2
r0=bc728e4e7b42d9f32b5e2b9e85880b7b6b38b1a829f6fcd633747e6c3e207d38
r1=44ed2c43b54ac2500bee1234a983adbb3fa5ff8da0e12c7cf5941495cf188574
r2=a40e6447ccbdb1a014b11887b9a097e72841d282ff2f508d88b78a5457b0831b
r3=a6bf5571b08fafa85010de6fdaf44368ca4e8e8552b98e7610d991ec257bc0b3
c0=02aaf9df02e2c7021c986b4ad8ddfba1ed6be0dea13b097d3a0614be32812195d6
c1=023024f5e60598d1bf1bc33093c8012e8d80556f87df631a7980f293df8ef5b788
c2=032e986a414555b5ec0572da1fe5997632ec8be5b18c08765e7644e686eb2c3c99
c3=03ba3cf5c47fb9f186ad3406484cd6c3ca409e688678ca77f69cb871fc092598d8
c=02e340fbd0a03ece1722ce090ac5e90754a5f184cf6a621a3de030c4d7411db092
val=02e340fbd0a03ece1722ce090ac5e90754a5f184cf6a621a3de030c4d7411db092
Peggy has proven that her value is positive

Once we have tested it, we can now put it into a function:

Here is the demo:

https://asecuritysite.com/zero/z_df4

Reference

[1] Damgård, I., & Fujisaki, E. (2002, December). A statistically-hiding integer commitment scheme based on groups with hidden order. In International Conference on the Theory and Application of Cryptology and Information Security (pp. 125–142). Springer, Berlin, Heidelberg.