-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataServerProtocol.h
69 lines (57 loc) · 2.22 KB
/
DataServerProtocol.h
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
#ifndef DataServerProtocol_h
#define DataServerProtocol_h
#include <vector>
#include <NTL/vec_ZZ_p.h>
#include <NTL/mat_ZZ_p.h>
#include <fstream>
#include <nlohmann/json.hpp>
#include <chrono>
#include "../PVSS/helperFunctions.h"
#include "../DPF/dpf.h"
#include "../SSSharing/SSSharing.h"
/*
This class implements the calculations for the PACL protocol on the data server side.
It can be seen as the outer LWS protocol, which is used to calculate the Tau's for the master server to decide if a user is allowed to access a file.
For realising that the class uses the DPF and SSSharing protocols.
*/
class DataServerProtocol{
private:
// DPF parameters
std::vector<uint8_t> dpf_key;
std::vector<uint8_t> dpf_values_char;
std::vector<int> dpf_values;
size_t dpf_key_size_logn;
// SSSharing parameters
// Vector of all Xshares values from all servers
std::vector<NTL::vec_ZZ_p> Xshares;
// Yshares for this specific server
NTL::vec_ZZ_p Yshares;
// outer protocol parameters
int numberOfFiles;
int secretSizeOfFiles;
int mod_q;
int serverNumber;
std::vector<NTL::vec_ZZ_p> Asi;
NTL::mat_ZZ_p A;
NTL::vec_ZZ_p B;
NTL::vec_ZZ_p TAU;
public:
// Save the publicly know parameters in the class
DataServerProtocol(NTL::mat_ZZ_p& A, std::vector<NTL::vec_ZZ_p>& Asi, const int& numberOfFiles, const int& secretSizeOfFiles, const int& mod_q, const int& serverNumber){
this->Asi = Asi;
this->A = A;
this->numberOfFiles = numberOfFiles;
this->secretSizeOfFiles = secretSizeOfFiles;
this->mod_q = mod_q;
this->serverNumber = serverNumber;
this->B.SetLength(secretSizeOfFiles);
};
// Set the DPF key
void setDPFKey(const std::vector<uint8_t>& key, size_t& key_size_logn);
// Set the SSSharing keys
void setSSSharingKeyX(std::vector<NTL::vec_ZZ_p> Xshares);
void setSSSharingKeyY(std::vector<long> Yshares);
// calculate Tau's by evaluating the DPF and using the SSSharing keys
NTL::vec_ZZ_p calculateTau();
};
#endif /* DataServerProtocol_h */