forked from lulululichuan/GroupCommu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GM.h
48 lines (44 loc) · 916 Bytes
/
GM.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
#pragma once
#include "common.h"
#include <MMX/RsaSignature.h>
#include <vector>
#include "SHA512.h"
namespace group_sig
{
struct member_info
{
string id;
ZZ y;
ZZ z;
};
class GM
{
public:
explicit GM(long lambda, ZZ psk)
: lambda(lambda), psk(psk)
{
rsa_.generateKeyPair();
init();
}
void init();
public_para getPublicPara() const;
ZZ verify(string id, string msg);
string open(ZZ gg, ZZ zz);
bool SKLOGver(const ZZ &m, const ZZ &y, const ZZ &g, const cspair &p) const;
void keyExchangeRequest(string id);
void onKeyExchangeResponseRecv(string msg);
string getBroadcastMsg();
private:
shared_ptr<logger> Log;
RSA::RsaSignature rsa_; // (n b)
ZZ G;
ZZ g; // 循环群G,g为生成元,G的阶是G-1
ZZ a;
long lambda; //群成员私钥长度
ZZ epsilon;
vector<member_info> info;
vector<ZZ> keyChain;
ZZ groupKey;
ZZ psk;
};
}