1 | <?php |
||
13 | trait CryptTrait |
||
14 | { |
||
15 | /** |
||
16 | * @var \League\OAuth2\Server\CryptKey |
||
17 | */ |
||
18 | protected $privateKey; |
||
19 | |||
20 | /** |
||
21 | * @var \League\OAuth2\Server\CryptKey |
||
22 | */ |
||
23 | protected $publicKey; |
||
24 | |||
25 | /** |
||
26 | * Set path to private key. |
||
27 | * |
||
28 | * @param \League\OAuth2\Server\CryptKey $privateKey |
||
29 | */ |
||
30 | public function setPrivateKey(CryptKey $privateKey) |
||
34 | |||
35 | /** |
||
36 | * Set path to public key. |
||
37 | * |
||
38 | * @param \League\OAuth2\Server\CryptKey $publicKey |
||
39 | */ |
||
40 | public function setPublicKey(CryptKey $publicKey) |
||
44 | |||
45 | /** |
||
46 | * Encrypt data with a private key. |
||
47 | * |
||
48 | * @param string $unencryptedData |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | protected function encrypt($unencryptedData) |
||
79 | |||
80 | /** |
||
81 | * Decrypt data with a public key. |
||
82 | * |
||
83 | * @param string $encryptedData |
||
84 | * |
||
85 | * @throws \LogicException |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | protected function decrypt($encryptedData) |
||
118 | } |
||
119 |