github.com/jiajun1992/watercarver@v0.0.0-20191031150618-dfc2b17c0c4a/StadiumForWaterCarver/src/ElGammal.h (about) 1 /* 2 * ElGammal.h 3 * 4 * Created on: 03.10.2010 5 * Author: stephaniebayer 6 * 7 * An instance of the class represent the ElGammal encryption, it has information of the group used the secret and 8 * public key. The class also provides functions to encrypt and decrypt 9 */ 10 11 #ifndef ELGAMMAL_H_ 12 #define ELGAMMAL_H_ 13 14 #include "Cipher_elg.h" 15 #include "G_q.h" 16 #include "FakeZZ.h" 17 #include "CurvePoint.h" 18 NTL_CLIENT 19 20 #include "Mod_p.h" 21 22 23 class ElGammal { 24 private: 25 G_q G; //Group used for encryption 26 ZZ sk; //secret key 27 Mod_p pk; //public key 28 public: 29 //Constructor & destructor 30 void print() const; 31 ElGammal(); 32 ElGammal(const ElGammal &other); 33 virtual ~ElGammal(); 34 35 //Access to the variables 36 G_q get_group() const; 37 Mod_p get_pk() const; 38 ZZ get_sk() const; 39 40 //functions to change parameters 41 void set_group(G_q G); 42 void set_sk(ZZ s); 43 void set_sk(long s); 44 void set_pk(Mod_p& pk_); 45 46 //encryption and decryption functions 47 Cipher_elg encrypt(Mod_p m, ZZ ran); 48 Cipher_elg encrypt(CurvePoint m, ZZ ran); 49 50 //decryption function 51 Mod_p decrypt(Cipher_elg c); 52 53 //Assigment operator 54 void operator =(const ElGammal& el); 55 56 }; 57 58 #endif /* ELGAMMAL_H_ */