PaillierPublicParameters.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (C) 2014 Carlos Aguilar Melchor, Joris Barrier, Marc-Olivier Killijian
  2. * This file is part of XPIR.
  3. *
  4. * XPIR is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * XPIR is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with XPIR. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef DEF_PAILLIERPUBLICPARAMETERS
  18. #define DEF_PAILLIERPUBLICPARAMETERS
  19. #include <string.h>
  20. #include "AbstractPublicParameters.hpp"
  21. #include "PaillierKeys.hpp"
  22. class PaillierPublicParameters : public AbstractPublicParameters {
  23. private:
  24. unsigned int bitKeySize;
  25. unsigned int byteKeySize;
  26. unsigned int bitAbsSize;
  27. unsigned int ciphSize;
  28. unsigned int securityBits;
  29. paillier_pubkey pubkey;
  30. public:
  31. unsigned int getCiphBitsizeFromRecLvl(unsigned int);
  32. unsigned int getCiphertextBitsize();
  33. unsigned int getQuerySizeFromRecLvl(unsigned int);
  34. PaillierPublicParameters();
  35. ~PaillierPublicParameters();
  36. void setModulusbits(unsigned int modulusbits);
  37. void setSecurityBits(unsigned int securitybits);
  38. void computeNewParameters(const std::string& crypto_param_descriptor);
  39. char* getByteModulus();
  40. std::string getSerializedParams(bool shortversion);
  41. unsigned int getKeyBitsize();
  42. unsigned int getAbsorptionBitsize();
  43. unsigned int getAbsorptionBitsize(unsigned int i);
  44. unsigned int getCiphertextSize();
  45. unsigned int getSerializedModulusBitsize();
  46. paillier_pubkey* getPubKey();
  47. void setModulus(char* pubKey);
  48. void setMockedPubKey();
  49. };
  50. #endif