/* Fuzzy IBE - Sahai-Waters See http://eprint.iacr.org/2004/086.pdf Section 4.1 Compile with modules as specified below For MR_PAIRING_CP curve cl /O2 /GX fuzzy.cpp cp_pair.cpp zzn2.cpp big.cpp zzn.cpp ecn.cpp miracl.lib For MR_PAIRING_MNT curve cl /O2 /GX fuzzy.cpp mnt_pair.cpp zzn6a.cpp ecn3.cpp zzn3.cpp zzn2.cpp big.cpp zzn.cpp ecn.cpp miracl.lib For MR_PAIRING_BN curve cl /O2 /GX fuzzy.cpp bn_pair.cpp zzn12a.cpp ecn2.cpp zzn4.cpp zzn2.cpp big.cpp zzn.cpp ecn.cpp miracl.lib For MR_PAIRING_KSS curve cl /O2 /GX fuzzy.cpp kss_pair.cpp zzn18.cpp zzn6.cpp ecn3.cpp zzn3.cpp big.cpp zzn.cpp ecn.cpp miracl.lib For MR_PAIRING_BLS curve cl /O2 /GX fuzzy.cpp bls_pair.cpp zzn24.cpp zzn8.cpp zzn4.cpp zzn2.cpp ecn4.cpp big.cpp zzn.cpp ecn.cpp miracl.lib Test program */ #include #include //********* choose just one of these pairs ********** //#define MR_PAIRING_CP // AES-80 security //#define AES_SECURITY 80 //#define MR_PAIRING_MNT // AES-80 security //#define AES_SECURITY 80 #define MR_PAIRING_BN // AES-128 or AES-192 security #define AES_SECURITY 128 //#define AES_SECURITY 192 //#define MR_PAIRING_KSS // AES-192 security //#define AES_SECURITY 192 //#define MR_PAIRING_BLS // AES-256 security //#define AES_SECURITY 256 //********************************************* #include "pairing_3.h" // // Note that in this case Bobs attributes are "close enough" to Alices // so that he can decrypt // #define NATTR 20 // Universe of attributes #define NALICE 7 // number of Alice's attributes #define NBOB 7 // number of Bob's attributes #define Nd 5 // number required in common int Alice[NALICE]={7,6,3,4,12,1,9}; // Alice's attributes int Bob[NBOB]= {6,3,4,12,5,10,7}; // Bob's attributes // Check if person has attribute a int has_attribute(int num,int *attr,int a) { for (int i=0;iIOBASE=256; M=(char *)"test message"; cout << "Message to be encrypted= " << M << endl; mip->IOBASE=16; pfc.random(s); ED=lxor(M,pfc.hash_to_aes_key(pfc.power(Y,s))); for (j=0;jIOBASE=256; cout << "Decrypted message= " << M << endl; return 0; }