1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
asymmetriccipher.php
См. документацию.
1
<?php
8
namespace
Bitrix\Main\Security
;
9
10
abstract
class
AsymmetricCipher
11
{
17
public
function
encrypt
(
$data
,
$key
): bool|string
18
{
19
$keyInfo = $this->
getKeyInfo
(
$key
);
20
$chunkSize = $keyInfo[
'bits'
]/8 - 11;
21
22
$result
=
''
;
23
24
foreach
(str_split(
$data
, $chunkSize) as $chunk)
25
{
26
$encryptedChunk = $this->
doEncrypt
($chunk,
$key
);
27
28
if
($encryptedChunk ===
false
)
29
{
30
return
false
;
31
}
32
33
$result
.= $encryptedChunk;
34
}
35
36
return
base64_encode(
$result
);
37
}
38
44
public
function
decrypt
(
$data
,
$key
): bool|string
45
{
46
$result
=
''
;
47
48
$keyInfo = $this->
getKeyInfo
(
$key
);
49
$blockSize = $keyInfo[
'bits'
]/8;
50
51
foreach
(str_split(base64_decode(
$data
), $blockSize) as $chunk)
52
{
53
$decryptedChunk = $this->
doDecrypt
($chunk,
$key
);
54
55
if
($decryptedChunk ===
false
)
56
{
57
return
false
;
58
}
59
60
$result
.= $decryptedChunk;
61
}
62
63
return
$result
;
64
}
65
71
abstract
protected
function
doEncrypt
(
$data
,
$key
);
72
78
abstract
protected
function
doDecrypt
(
$data
,
$key
);
79
84
abstract
protected
function
getKeyInfo
(
$key
);
85
}
Bitrix\Main\Security\AsymmetricCipher
Определения
asymmetriccipher.php:11
Bitrix\Main\Security\AsymmetricCipher\decrypt
decrypt($data, $key)
Определения
asymmetriccipher.php:44
Bitrix\Main\Security\AsymmetricCipher\doDecrypt
doDecrypt($data, $key)
Bitrix\Main\Security\AsymmetricCipher\doEncrypt
doEncrypt($data, $key)
Bitrix\Main\Security\AsymmetricCipher\getKeyInfo
getKeyInfo($key)
Bitrix\Main\Security\AsymmetricCipher\encrypt
encrypt($data, $key)
Определения
asymmetriccipher.php:17
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
$result
$result
Определения
get_property_values.php:14
Bitrix\Main\Security
Определения
asymmetriccipher.php:8
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
bitrix
modules
main
lib
security
asymmetriccipher.php
Создано системой
1.14.0