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. * @ORM\Column(type="text", nullable=true)
  32. */
  33. private ?string $hash = null;
  34. /**
  35. * Constructor
  36. */
  37. public function __construct()
  38. {
  39. $this->dateAdd = new \DateTime();
  40. }
  41. public function getId(): ?int
  42. {
  43. return $this->id;
  44. }
  45. public function getDateAdd(): \DateTime
  46. {
  47. return $this->dateAdd;
  48. }
  49. public function getPublicKey(): string
  50. {
  51. return \base64_decode($this->publicKey);
  52. }
  53. public function setPublicKey(string $publicKey): EncryptionKey
  54. {
  55. $this->publicKey = \base64_encode($publicKey);
  56. return $this;
  57. }
  58. public function getPrivateKey(): string
  59. {
  60. return \base64_decode($this->privateKey);
  61. }
  62. public function setPrivateKey(string $privateKey): EncryptionKey
  63. {
  64. $this->privateKey = \base64_encode($privateKey);
  65. return $this;
  66. }
  67. public function getHash(): ?string
  68. {
  69. return $this->hash;
  70. }
  71. public function setHash(?string $hash): EncryptionKey
  72. {
  73. $this->hash = $hash;
  74. return $this;
  75. }
  76. }