src/Entity/System/EncryptionKey.php line 12

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\System;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity(repositoryClass="App\Repository\System\EncryptionKeyRepository")
  7. */
  8. class EncryptionKey
  9. {
  10. /**
  11. * @ORM\Column(type="integer")
  12. *
  13. * @ORM\Id
  14. *
  15. * @ORM\GeneratedValue(strategy="AUTO")
  16. */
  17. protected ?int $id;
  18. /**
  19. * @ORM\Column(type="datetime")
  20. */
  21. protected \DateTime $dateAdd;
  22. /**
  23. * @ORM\Column(type="text")
  24. */
  25. protected string $publicKey;
  26. /**
  27. * @ORM\Column(type="text")
  28. */
  29. protected string $privateKey;
  30. /**
  31. * Constructor
  32. */
  33. public function __construct()
  34. {
  35. $this->dateAdd = new \DateTime();
  36. }
  37. public function getId(): ?int
  38. {
  39. return $this->id;
  40. }
  41. public function getDateAdd(): \DateTime
  42. {
  43. return $this->dateAdd;
  44. }
  45. public function getPublicKey(): string
  46. {
  47. return \base64_decode($this->publicKey);
  48. }
  49. public function setPublicKey(string $publicKey): EncryptionKey
  50. {
  51. $this->publicKey = \base64_encode($publicKey);
  52. return $this;
  53. }
  54. public function getPrivateKey(): string
  55. {
  56. return \base64_decode($this->privateKey);
  57. }
  58. public function setPrivateKey(string $privateKey): EncryptionKey
  59. {
  60. $this->privateKey = \base64_encode($privateKey);
  61. return $this;
  62. }
  63. }