fentec-project / gofe

Functional encryption library in Go
Apache License 2.0
170 stars 51 forks source link

How to calculate intermediate values in multi input scheme? #41

Closed b-rohit closed 3 years ago

b-rohit commented 4 years ago

I followed the example given in the README file. I understood the Decrypt function returns the mod after executing decryption for number of Slots times. I am interested in how can I calculate intermediate values (c, OTPKey) defined in the Decrypt function. I put some debug logs in the function and checked the research paper but could not come up with formula. Use following sample values.

X :  [ 3 3 4  2 3 2]
Y :  [ 1 2 1  1 0 1]
opt key:  [ 2 3 1  4 2 3]
c0:  2
c1:  1
OTPKey  1

Could someone explain how c0, c1 and OTPKey can be calculated ?

tilenmarc commented 4 years ago

Hi, I am not sure what exactly are you asking. Do you want to know how c and OTP are calculated? OTP is just a random vector that gets created by the central authority during master keys generation (function GenerateMasterKeys) and OTPkey is then derived out of it for the decryption. Not sure what you mean by c0 and c1, please explain a bit more precise. Best, Tilen

b-rohit commented 4 years ago

Yes, I want to know how c is calculated not in terms of encryption and decryption but in simple maths operations.

tilenmarc commented 4 years ago

I am guessing that by c you mean the variable defined in the implementation of the decryption. The algorithm is an implementation of algorithm in Figure 3 in this paper. In the paper these values are named D_i. They are the decryptions using the underlying DDH based scheme. If you want to see the exact math operations used to get them check the algorithm used in the decryption of DDH based scheme in this paper. You can also directly check the code here