Edit File by line
/home/barbar84/www/wp-conte.../plugins/worker/src/MWP/Crypter
File: OpenSslCrypter.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
* This file is part of the ManageWP Worker plugin.
[2] Fix | Delete
*
[3] Fix | Delete
* (c) ManageWP LLC <contact@managewp.com>
[4] Fix | Delete
*
[5] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[6] Fix | Delete
* file that was distributed with this source code.
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
class MWP_Crypter_OpenSslCrypter implements MWP_Crypter_Interface
[10] Fix | Delete
{
[11] Fix | Delete
public function publicEncrypt($data, $publicKey)
[12] Fix | Delete
{
[13] Fix | Delete
$errorCatcher = new MWP_Debug_ErrorCatcher();
[14] Fix | Delete
$errorCatcher->register('openssl_public_encrypt');
[15] Fix | Delete
/** @handled function */
[16] Fix | Delete
$success = @openssl_public_encrypt($data, $crypted, $publicKey);
[17] Fix | Delete
$lastError = $errorCatcher->yieldErrorMessage(true);
[18] Fix | Delete
[19] Fix | Delete
if ($success === false) {
[20] Fix | Delete
$error = $errorRow = '';
[21] Fix | Delete
[22] Fix | Delete
/** @handled function */
[23] Fix | Delete
while (($errorRow = openssl_error_string()) !== false) {
[24] Fix | Delete
$error = $errorRow."\n".$error;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
throw new MWP_Worker_Exception(MWP_Worker_Exception::OPENSSL_ENCRYPT_ERROR, "There was an error while trying to use OpenSSL to encrypt a message.", array(
[28] Fix | Delete
'openSslError' => $error,
[29] Fix | Delete
'error' => isset($lastError['message']) ? $lastError['message'] : null,
[30] Fix | Delete
));
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
return $crypted;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
public function publicDecrypt($data, $publicKey)
[37] Fix | Delete
{
[38] Fix | Delete
$errorCatcher = new MWP_Debug_ErrorCatcher();
[39] Fix | Delete
$errorCatcher->register('openssl_public_decrypt');
[40] Fix | Delete
/** @handled function */
[41] Fix | Delete
$success = @openssl_public_decrypt($data, $decrypted, $publicKey);
[42] Fix | Delete
$lastError = $errorCatcher->yieldErrorMessage(true);
[43] Fix | Delete
[44] Fix | Delete
if ($success === false && $lastError !== null) {
[45] Fix | Delete
$error = $errorRow = '';
[46] Fix | Delete
[47] Fix | Delete
/** @handled function */
[48] Fix | Delete
while (($errorRow = openssl_error_string()) !== false) {
[49] Fix | Delete
$error = $errorRow."\n".$error;
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
throw new MWP_Worker_Exception(MWP_Worker_Exception::OPENSSL_DECRYPT_ERROR, "There was an error while trying to use OpenSSL to decrypt a message.", array(
[53] Fix | Delete
'openSslError' => $error,
[54] Fix | Delete
'error' => $lastError,
[55] Fix | Delete
));
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
return $decrypted === false ? null : $decrypted;
[59] Fix | Delete
}
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function