Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
09bf25b5e2
commit
e2390f67d4
@@ -7,9 +7,10 @@ use Config;
|
||||
use Exception;
|
||||
use Schema;
|
||||
|
||||
class LibraryController extends Controller {
|
||||
|
||||
public static function getFileVersion() {
|
||||
class LibraryController extends Controller
|
||||
{
|
||||
public static function getFileVersion()
|
||||
{
|
||||
try {
|
||||
$app = Config::get('app.version');
|
||||
if ($app) {
|
||||
@@ -22,7 +23,8 @@ class LibraryController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public static function getDatabaseVersion() {
|
||||
public static function getDatabaseVersion()
|
||||
{
|
||||
try {
|
||||
$database = self::isDatabaseSetup();
|
||||
if ($database == true) {
|
||||
@@ -39,7 +41,8 @@ class LibraryController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public static function isDatabaseSetup() {
|
||||
public static function isDatabaseSetup()
|
||||
{
|
||||
try {
|
||||
if (Schema::hasTable('settings_system')) {
|
||||
return true;
|
||||
@@ -49,47 +52,50 @@ class LibraryController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public static function encryptByFaveoPublicKey($data) {
|
||||
public static function encryptByFaveoPublicKey($data)
|
||||
{
|
||||
try {
|
||||
$path = storage_path() . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'public.key';
|
||||
$path = storage_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'public.key';
|
||||
//dd($path);
|
||||
$key_content = file_get_contents($path);
|
||||
$public_key = openssl_get_publickey($key_content);
|
||||
|
||||
$encrypted = $e = NULL;
|
||||
openssl_seal($data, $encrypted, $e, array($public_key));
|
||||
$encrypted = $e = null;
|
||||
openssl_seal($data, $encrypted, $e, [$public_key]);
|
||||
|
||||
$sealed_data = base64_encode($encrypted);
|
||||
$envelope = base64_encode($e[0]);
|
||||
|
||||
$result = ['seal' => $sealed_data, 'envelope' => $envelope];
|
||||
|
||||
return json_encode($result);
|
||||
} catch (Exception $ex) {
|
||||
throw new Exception($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static function decryptByFaveoPrivateKey($encrypted) {
|
||||
|
||||
public static function decryptByFaveoPrivateKey($encrypted)
|
||||
{
|
||||
try {
|
||||
$encrypted = json_decode($encrypted);
|
||||
$sealed_data = $encrypted->seal;
|
||||
$envelope = $encrypted->envelope;
|
||||
$input = base64_decode($sealed_data);
|
||||
$einput = base64_decode($envelope);
|
||||
$path = storage_path('app' . DIRECTORY_SEPARATOR . 'private.key');
|
||||
$path = storage_path('app'.DIRECTORY_SEPARATOR.'private.key');
|
||||
$key_content = file_get_contents($path);
|
||||
$private_key = openssl_get_privatekey($key_content);
|
||||
$plaintext = NULL;
|
||||
$plaintext = null;
|
||||
openssl_open($input, $plaintext, $einput, $private_key);
|
||||
|
||||
return $plaintext;
|
||||
} catch (Exception $ex) {
|
||||
// dd($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static function _isCurl() {
|
||||
public static function _isCurl()
|
||||
{
|
||||
return function_exists('curl_version');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user