TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
RsaEncryptionDecoder.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
20
class
RsaEncryptionDecoder
implements
\TYPO3\CMS\Core\SingletonInterface
21
{
25
protected
$backend
;
26
30
protected
$storage
;
31
35
protected
$key
;
36
41
public
function
decrypt
($data)
42
{
43
if
($this->
getKey
() ===
''
|| !$this->
isAvailable
()) {
44
return
$data;
45
}
46
47
$decryptedData = is_array($data) ? $data : [$data];
48
$decryptedData = $this->
decryptDataArray
($decryptedData);
49
$this->
getStorage
()->put(
null
);
50
51
return
is_array($data) ? $decryptedData : $decryptedData[0];
52
}
53
57
public
function
isAvailable
()
58
{
59
return
$this->
getBackend
() instanceof
Backend\AbstractBackend
;
60
}
61
66
protected
function
decryptDataArray
(array $data)
67
{
68
foreach
($data as
$key
=> $value) {
69
if
(empty($value)) {
70
continue
;
71
}
72
if
(is_array($value)) {
73
$data[
$key
] = $this->
decryptDataArray
($value);
74
continue
;
75
}
76
77
if
(strpos($value,
'rsa:'
) !== 0) {
78
continue
;
79
}
80
81
$decryptedValue = $this->
getBackend
()->decrypt($this->
getKey
(), substr($value, 4));
82
if
($decryptedValue !==
null
) {
83
$data[
$key
] = $decryptedValue;
84
}
85
}
86
87
return
$data;
88
}
89
93
protected
function
getKey
()
94
{
95
if
($this->key ===
null
) {
96
$this->key = $this->
getStorage
()->get();
97
98
if
($this->key ===
null
) {
99
$this->key =
''
;
100
}
101
}
102
103
return
$this->key
;
104
}
105
109
protected
function
getBackend
()
110
{
111
if
($this->backend ===
null
) {
112
$this->backend =
Backend\BackendFactory::getBackend
();
113
}
114
115
return
$this->backend
;
116
}
117
121
protected
function
getStorage
()
122
{
123
if
($this->storage ===
null
) {
124
$this->storage =
Storage\StorageFactory::getStorage
();
125
}
126
127
return
$this->storage
;
128
}
129
}
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\decryptDataArray
array decryptDataArray(array $data)
Definition:
RsaEncryptionDecoder.php:63
TYPO3\CMS\Rsaauth\Backend\AbstractBackend
Definition:
AbstractBackend.php:35
TYPO3\CMS\Rsaauth\Storage\StorageFactory\getStorage
static TYPO3 CMS Rsaauth Storage AbstractStorage getStorage()
Definition:
StorageFactory.php:47
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\$storage
Storage AbstractStorage $storage
Definition:
RsaEncryptionDecoder.php:28
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\decrypt
string array decrypt($data)
Definition:
RsaEncryptionDecoder.php:38
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\$key
string $key
Definition:
RsaEncryptionDecoder.php:32
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\getKey
string getKey()
Definition:
RsaEncryptionDecoder.php:90
TYPO3\CMS\Rsaauth\Backend\BackendFactory\getBackend
static AbstractBackend getBackend()
Definition:
BackendFactory.php:55
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder
Definition:
RsaEncryptionDecoder.php:21
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\$backend
Backend AbstractBackend $backend
Definition:
RsaEncryptionDecoder.php:24
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\getStorage
Storage AbstractStorage getStorage()
Definition:
RsaEncryptionDecoder.php:118
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\isAvailable
bool isAvailable()
Definition:
RsaEncryptionDecoder.php:54
TYPO3\CMS\Rsaauth\Storage\AbstractStorage
Definition:
AbstractStorage.php:21
TYPO3\CMS\Core\SingletonInterface
Definition:
SingletonInterface.php:22
TYPO3\CMS\Rsaauth\RsaEncryptionDecoder\getBackend
Backend AbstractBackend null getBackend()
Definition:
RsaEncryptionDecoder.php:106
TYPO3\CMS\Rsaauth
doxygen
typo3
sysext
rsaauth
Classes
RsaEncryptionDecoder.php
Generated on Tue Oct 5 2021 01:57:55 for TYPO3CMS by
1.8.18