PublicKey.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "PublicKey.hpp"
  2. PublicKey public_key;
  3. Bipoint<curvepoint_fp_t> PublicKey::get_bipoint_curvegen() const
  4. {
  5. return bipoint_curvegen;
  6. }
  7. Bipoint<twistpoint_fp2_t> PublicKey::get_bipoint_twistgen() const
  8. {
  9. return bipoint_twistgen;
  10. }
  11. Bipoint<curvepoint_fp_t> PublicKey::get_bipoint_curve_groupelt() const
  12. {
  13. return bipoint_curve_groupelt;
  14. }
  15. Bipoint<twistpoint_fp2_t> PublicKey::get_bipoint_twist_groupelt() const
  16. {
  17. return bipoint_twist_groupelt;
  18. }
  19. void PublicKey::print() const
  20. {
  21. cout << RED << "affichage du point i1.g" << RESET << endl;
  22. bipoint_curvegen.print(0);
  23. JUMP;
  24. cout << RED << "affichage du point j1.g" << RESET << endl;
  25. bipoint_curvegen.print(1);
  26. JUMP;
  27. cout << RED << "affichage du point i2.h" << RESET << endl;
  28. bipoint_twistgen.print(0);
  29. JUMP;
  30. cout << RED << "affichage du point j2.h" << RESET << endl;
  31. bipoint_twistgen.print(1);
  32. JUMP;
  33. cout << RED << "affichage du point u[0]" << RESET << endl;
  34. bipoint_curve_groupelt.print(0);
  35. JUMP;
  36. cout << RED << "affichage du point u[1]" << RESET << endl;
  37. bipoint_curve_groupelt.print(1);
  38. JUMP;
  39. cout << RED << "affichage du point v[0]" << RESET << endl;
  40. bipoint_twist_groupelt.print(0);
  41. JUMP;
  42. cout << RED << "affichage du point v[1]" << RESET << endl;
  43. bipoint_twist_groupelt.print(1);
  44. JUMP;
  45. }
  46. PublicKey::PublicKey(Bipoint<curvepoint_fp_t> a ,Bipoint<twistpoint_fp2_t> b, Bipoint<curvepoint_fp_t> c ,Bipoint<twistpoint_fp2_t> d)
  47. {
  48. a.makeaffine();
  49. b.makeaffine();
  50. c.makeaffine();
  51. d.makeaffine();
  52. bipoint_curvegen = a;
  53. bipoint_twistgen = b;
  54. bipoint_curve_groupelt = c;
  55. bipoint_twist_groupelt = d;
  56. }
  57. void PublicKey::set(Bipoint<curvepoint_fp_t> a,Bipoint<twistpoint_fp2_t> b, Bipoint<curvepoint_fp_t> c ,Bipoint<twistpoint_fp2_t> d)
  58. {
  59. a.makeaffine();
  60. b.makeaffine();
  61. c.makeaffine();
  62. d.makeaffine();
  63. bipoint_curvegen = a;
  64. bipoint_twistgen = b;
  65. bipoint_curve_groupelt = c;
  66. bipoint_twist_groupelt = d;
  67. }