/home/vianto5/.trash/cititower.mx/wp-content/plugins/wordfence/lib
Edit: /home/vianto5/.trash/cititower.mx/wp-content/plugins/wordfence/lib/wfCrypt.php (4146B)
, 'signature' => ).
*/
public static function noc1_encrypt($payload) {
$payloadJSON = json_encode($payload);
$keyData = file_get_contents(dirname(__FILE__) . '/noc1.key');
$key = @openssl_get_publickey($keyData);
if ($key !== false) {
$symmetricKey = wfWAFUtils::random_bytes(32);
$iv = wfWAFUtils::random_bytes(16);
$encrypted = @openssl_encrypt($payloadJSON, 'aes-256-cbc', $symmetricKey, OPENSSL_RAW_DATA, $iv);
if ($encrypted !== false) {
$success = openssl_public_encrypt($symmetricKey, $symmetricKeyEncrypted, $key, OPENSSL_PKCS1_OAEP_PADDING);
if ($success) {
$message = $iv . $symmetricKeyEncrypted . $encrypted;
$signatureRaw = hash('sha256', $message, true);
$success = openssl_public_encrypt($signatureRaw, $signature, $key, OPENSSL_PKCS1_OAEP_PADDING);
if ($success) {
$package = array('message' => bin2hex($message), 'signature' => bin2hex($signature));
return $package;
}
}
}
}
return array();
}
/**
* Returns a SHA256 HMAC for $payload using the local long key.
*
* @param $payload
* @return false|string
*/
public static function local_sign($payload) {
return hash_hmac('sha256', $payload, wfConfig::get('longEncKey'));
}
}