mirror of
https://github.com/friendica/friendica
synced 2025-04-26 03:50:12 +00:00
Reverting RINO crypto code to php-encryption version 1.2
This commit is contained in:
parent
ccf4dcf270
commit
ee5b9de6ad
2 changed files with 16 additions and 9 deletions
|
@ -1296,17 +1296,22 @@ class DFRN
|
|||
case 2:
|
||||
// RINO 2 based on php-encryption
|
||||
try {
|
||||
$KeyObject = \Defuse\Crypto\Key::createNewRandomKey();
|
||||
} catch (\Defuse\Crypto\Exception\CryptoException $ex) {
|
||||
$key = \Crypto::createNewRandomKey();
|
||||
} catch (\CryptoTestFailedException $ex) {
|
||||
logger('Cannot safely create a key');
|
||||
return -4;
|
||||
} catch (\CannotPerformOperationException $ex) {
|
||||
logger('Cannot safely create a key');
|
||||
return -5;
|
||||
}
|
||||
try {
|
||||
$data = \Defuse\Crypto\Crypto::encrypt($postvars['data'], $KeyObject);
|
||||
$key = $KeyObject->saveToAsciiSafeString();
|
||||
} catch (\Defuse\Crypto\Exception\CryptoException $ex) {
|
||||
$data = Crypto::encrypt($postvars['data'], $key);
|
||||
} catch (\CryptoTestFailedException $ex) {
|
||||
logger('Cannot safely perform encryption');
|
||||
return -6;
|
||||
} catch (\CannotPerformOperationException $ex) {
|
||||
logger('Cannot safely perform encryption');
|
||||
return -7;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue