‪TYPO3CMS  9.5
Keypair.php
Go to the documentation of this file.
1 <?php
2 namespace ‪TYPO3\CMS\Rsaauth;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 {
28  protected ‪$exponent = 0;
29 
35  protected ‪$privateKey = '';
36 
42  protected ‪$publicKeyModulus = 0;
43 
49  public function ‪isReady()
50  {
51  return $this->‪hasExponent() && $this->‪hasPrivateKey() && $this->‪hasPublicKeyModulus();
52  }
53 
59  public function ‪getExponent()
60  {
61  return ‪$this->exponent;
62  }
63 
72  public function ‪setExponent(‪$exponent)
73  {
74  if ($this->‪hasExponent()) {
75  throw new \BadMethodCallException('setExponent() must not be called more than one time.', 1296062830);
76  }
77 
78  $this->exponent = ‪$exponent;
79  }
80 
86  protected function ‪hasExponent()
87  {
88  return $this->‪getExponent() !== 0;
89  }
90 
96  public function ‪getPrivateKey()
97  {
98  return ‪$this->privateKey;
99  }
100 
109  public function ‪setPrivateKey(‪$privateKey)
110  {
111  if ($this->‪hasPrivateKey()) {
112  throw new \BadMethodCallException('setPrivateKey() must not be called more than one time.', 1296062831);
113  }
114 
115  $this->privateKey = ‪$privateKey;
116  }
117 
123  protected function ‪hasPrivateKey()
124  {
125  return $this->‪getPrivateKey() !== '';
126  }
127 
133  public function ‪getPublicKeyModulus()
134  {
136  }
137 
146  public function ‪setPublicKey(‪$publicKeyModulus)
147  {
148  if ($this->‪hasPublicKeyModulus()) {
149  throw new \BadMethodCallException('setPublicKey() must not be called more than one time.', 1296062832);
150  }
151 
152  $this->publicKeyModulus = ‪$publicKeyModulus;
153  }
154 
160  protected function ‪hasPublicKeyModulus()
161  {
162  return $this->‪getPublicKeyModulus() !== 0;
163  }
164 }
‪TYPO3\CMS\Rsaauth\Keypair\setPrivateKey
‪setPrivateKey($privateKey)
Definition: Keypair.php:106
‪TYPO3\CMS\Rsaauth\Keypair\setExponent
‪setExponent($exponent)
Definition: Keypair.php:69
‪TYPO3\CMS\Rsaauth\Keypair\hasPrivateKey
‪bool hasPrivateKey()
Definition: Keypair.php:120
‪TYPO3\CMS\Rsaauth\Keypair\hasPublicKeyModulus
‪bool hasPublicKeyModulus()
Definition: Keypair.php:157
‪TYPO3\CMS\Rsaauth\Keypair\getExponent
‪int getExponent()
Definition: Keypair.php:56
‪TYPO3\CMS\Rsaauth\Keypair\$publicKeyModulus
‪int $publicKeyModulus
Definition: Keypair.php:39
‪TYPO3\CMS\Rsaauth\Keypair\hasExponent
‪bool hasExponent()
Definition: Keypair.php:83
‪TYPO3\CMS\Rsaauth\Keypair\getPublicKeyModulus
‪int getPublicKeyModulus()
Definition: Keypair.php:130
‪TYPO3\CMS\Rsaauth\Keypair\$privateKey
‪string $privateKey
Definition: Keypair.php:33
‪TYPO3\CMS\Rsaauth\Keypair
Definition: Keypair.php:22
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪TYPO3\CMS\Rsaauth\Keypair\setPublicKey
‪setPublicKey($publicKeyModulus)
Definition: Keypair.php:143
‪TYPO3\CMS\Rsaauth\Keypair\$exponent
‪int $exponent
Definition: Keypair.php:27
‪TYPO3\CMS\Rsaauth\Keypair\isReady
‪bool isReady()
Definition: Keypair.php:46
‪TYPO3\CMS\Rsaauth\Keypair\getPrivateKey
‪string getPrivateKey()
Definition: Keypair.php:93
‪TYPO3\CMS\Rsaauth