/* Boneh-Gentry-Waters Collusion Resistant Broadcast Encryption With Short Ciphertexts and Private Keys Implemented on Type-1 pairing Compile with modules as specified below For MR_PAIRING_SSP curves cl /O2 /GX bgw.cpp ssp_pair.cpp ecn.cpp zzn2.cpp zzn.cpp big.cpp miracl.lib For MR_PAIRING_SS2 curves cl /O2 /GX bgw.cpp ss2_pair.cpp ec2.cpp gf2m4x.cpp gf2m.cpp big.cpp miracl.lib or of course g++ -O2 bgw.cpp ss2_pair.cpp ec2.cpp gf2m4x.cpp gf2m.cpp big.cpp miracl.a -o bgw See http://eprint.iacr.org/2005/018.pdf Section 3.1 */ #include #include //********* CHOOSE JUST ONE OF THESE ********** #define MR_PAIRING_SS2 // AES-80 or AES-128 security GF(2^m) curve //#define AES_SECURITY 80 // OR #define AES_SECURITY 128 //#define MR_PAIRING_SSP // AES-80 or AES-128 security GF(p) curve //#define AES_SECURITY 80 // OR //#define AES_SECURITY 128 //********************************************* #include "pairing_1.h" #define N 20 // total number of potential recipients #define NS 5 // number of recipients for this broadcast int S[NS]={2,4,5,6,14}; // group of recipients #define PERSON 6 // sample recipient int main() { PFC pfc(AES_SECURITY); // initialise pairing-friendly curve time_t seed; int i,j; G1 g,v,gi[2*N],d[N],Hdr[2],s; GT K; Big alpha,gamma,t; time(&seed); // initialise (insecure!) random numbers irand((long)seed); //setup pfc.random(g); pfc.random(alpha); gi[0]=pfc.mult(g,alpha); for (i=1;i<2*N;i++) gi[i]=pfc.mult(gi[i-1],alpha); pfc.random(gamma); v=pfc.mult(g,gamma); for (i=0;i