I have tried various Changes to encryption.php codes as follows:
<?php
final class Encryption {
private $cipher = 'aes-256-ctr';
private $digest = 'sha256';
private $key;
public function __construct($key) {
$this->key = $key;
}
public function encrypt($value) {
$key = openssl_digest($this->key, $this->digest, true);
$iv_length = openssl_cipher_iv_length($this->cipher);
$iv = openssl_random_pseudo_bytes($iv_length);
return base64_encode($iv . openssl_encrypt($value, $this->cipher, $key, OPENSSL_RAW_DATA, $iv));
}
public function decrypt($value) {
$key = openssl_digest($this->key, $this->digest, true);
$iv_length = openssl_cipher_iv_length($this->cipher);
$value = base64_decode($value);
$iv = substr($value, 0, $iv_length);
$value = substr($value, $iv_length);
return openssl_decrypt($value, $this->cipher, $key, OPENSSL_RAW_DATA, $iv);
}
}
Also ----------------------------------------------------------------------------------------------------------------------------------------------------------
<?php
final class Encryption {
private $key;
public function __construct($key) {
$this->key = $key;
}
public function encrypt($value) {
if (function_exists('sodium_crypto_secretbox')) {
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
return strtr(base64_encode($nonce . sodium_crypto_secretbox($value, $nonce, hash('sha256', $this->key, true))), '+/=', '-_,');
} else {
return strtr(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, hash('sha256', $this->key, true), $value, MCRYPT_MODE_ECB)), '+/=', '-_,');
}
}
public function decrypt($value) {
if (function_exists('sodium_crypto_secretbox')) {
$raw_value = base64_decode(strtr($value, '-_,', '+/='));
$nonce = substr($raw_value, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
return trim(sodium_crypto_secretbox_open(substr($raw_value, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES), $nonce, hash('sha256', $this->key, true)));
} else {
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, hash('sha256', $this->key, true), base64_decode(strtr($value, '-_,', '+/=')), MCRYPT_MODE_ECB));
}
}
}
?>
But no joy, can anyone help, it would be appreciated !! Am I missing something else I need to do?
And try this one:
Code: Select all
<?php
final class Encryption {
public function encrypt($key, $value) {
// Remove the base64 encoding from our key
$encryption_key = base64_decode($value);
// Generate an initialization vector
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-gcm'));
// Encrypt the data using AES 256 encryption in GCM mode using our encryption key and initialization vector.
if (in_array('aes-256-gcm', openssl_get_cipher_methods())) {
$tag = base64_encode($iv);
$encrypted = openssl_encrypt($key, 'aes-256-gcm', $encryption_key, 0, $iv, $tag);
// The $iv is just as important as the key for decrypting, so save it with our encrypted data using a unique separator (::)
return base64_encode($encrypted . '::' . $iv);
}
}
public function decrypt($key, $value) {
if (in_array('aes-256-gcm', openssl_get_cipher_methods())) {
// Remove the base64 encoding from our key
$encryption_key = base64_decode($value);
// To decrypt, split the encrypted data from our IV - our unique separator used was "::"
list($encrypted_data, $iv) = explode('::', base64_decode($key), 2);
$tag = base64_decode($iv);
return openssl_decrypt($encrypted_data, 'aes-256-gcm', $encryption_key, 0, $iv, $tag);
}
}
}
?>
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
How do I switch from mysql to mysqli in opencart?
Do I need to change to mysqli?
My Server Database Type MySQL (Standard)
Plus tried your code and the same result, just blank white screen for website ON PHP 7.2
Regards
Yes, mysql is no longer existing + valid on modern Servers.Do I need to change to mysqli?
In both config.php Files, change:
Code: Select all
// DB
define('DB_DRIVER', 'mysql');
Code: Select all
// DB
define('DB_DRIVER', 'mysqli');
And if it still does not work, you have to remove your VqMods,
except for the vqmod_opencart.xml itself, to find out,
if one of them plays some role, to eventually keep your Site
from working.
HOWEVER, better download the latest v.1.5.6.5_rc Version first,
and use this one instead of yours, it only contains about 25 fixes,
to fix problems, found after the v.1.5.6.4 was released, but everything
else is still the same Code as 1.5.6.4 !Just overwrite all existing OC Files
on the Server with the new Code, exept for the Shop config.php
files, it should not do any harm. (If you never manually modified OC Source!

And you also need to use the PHP-7 encryption.php file, as placed
above, to make it work with PHP7.2x at least. (I don't know about PHP 7.3 ,
since it is not available yet on my Server! But PHP 7.2x will stay for a while,
so, I would not care about 7.3 too much already anyway !

Ernie
https://github.com/IP-CAM/Opencart-1.5. ... .x-Release
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
I changed my config file to define('DB_DRIVER', 'mysqli');
I Changes to encryption.php code to the one you gave me!
But I still got the same plain white web page!
So I uninstalled all my VqMods, except for the vqmod_opencart.xml itself.
WORKS PERFECT on PHP 7.2!!!!!!!!
Thank you so much Ernie!
I so far only found a 'file-manager' tool, able to 'handle' file and pics,
but unable to further work with php7, but it's always good to know, if
other Mods might keep the Baby from doing it's Job.
Ernie
My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
any ideas?
Just to make it clear what I've done:
I have OC 1.5.2.1 on PHP5
I moved it to new server with PHP7
I edited encryption.php in /system/library folder (copied the code from above)
Then I edited /admin/config.php and config.php (in shop root) and added the "i" at end of "mysql"
I tried removing vqmods too, but no luck.
EDIT: I figured it's because i'm missing the actual mysqli.php file as OC 1.5.2.1 doesn't even have it, I tried copying it from OC2 and renaming mysql.php to mysqli.php, but both result in either error 500 or just white blank page. I tried loading both /store/ and /store/admin. With one combination I get error 500 on front and blank page on admin. I really want to get my current one working. I already tried upgrading and it gives error 500 after upgrade.
Any ideas? thanks.
100$


Copy mysqli.php (system/database) from 1.5.6.4 to your 1.5.2.1 (same path)
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
yeah I tried that, error 500 on shop front and blank page on /admin/
EDIT: I tried upgrading to 1.5.6.4, but it gives me ERROR 500 on admin panel after trying to login.
I suspect some extensions are giving me issues, but I can't exactly disable them if I can't even login.
EDIT2: has anyone tried installing 1.5.6.4 on PHP7 with the encryption.php mod? It's not working for me, I get the first license page (which seems bit broken) and when I click "continue" at bottom, then nothing happens. It seem to be just "refreshing" the page and nothing else happens.
I assume it's not possible to install one using this method?
I'm 99% sure that my old site's database has some entries that are causing the issue, I found some, but it's impossible to tell if it doesn't give me specific errors. I had some permission issues too, but again it's impossible to fix if I can't even see the errors.

Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk
Because you need to replace this code from install/index.php
Code: Select all
// HTTP
define('HTTP_SERVER', 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/');
define('HTTP_OPENCART', 'http://' . $_SERVER['HTTP_HOST'] . rtrim(rtrim(dirname($_SERVER['SCRIPT_NAME']), 'install'), '/.\\'). '/');
Code: Select all
// Check if SSL
if ((isset($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == '1'))) || $_SERVER['SERVER_PORT'] == 443) {
$protocol = 'https://';
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
$protocol = 'https://';
} else {
$protocol = 'http://';
}
Code: Select all
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Users browsing this forum: No registered users and 12 guests