The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Sorry just saw this - yes it should work. I've since changed one line of code - the new version checks iv length in case encrypted string is invalid:
Code: Select all
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) {
$result = NULL;
$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);
if (strlen($iv) == $iv_length) {
$result = openssl_decrypt($value, $this->cipher, $key, OPENSSL_RAW_DATA, $iv);
}
return $result;
}
}
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
Read my latest post on that thread as to why that version will not work.straightlight wrote: ↑Wed Oct 17, 2018 7:14 amI would rather recommend the use of this version: viewtopic.php?f=198&t=204707&p=725077#p725077
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Regards,
Straightlight
Programmer / Opencart Tester
I'm trying to get my 1.5.6.4 running on PHP 7.2 and it seems that I'm only having this problem right now (after editing encyption.php):
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /(domain_name_deleted)/httpd.www/system/library/dompdf/include/autoload.inc.php on line 83 Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /(domain_name_deleted)/httpd.www/system/library/session.php on line 7Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /(domain_name_deleted)/httpd.www/system/library/session.php on line 8Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /(domain_name_deleted)/httpd.www/system/library/session.php on line 9Warning: session_set_cookie_params(): Cannot change session cookie parameters when headers already sent in /(domain_name_deleted)/httpd.www/system/library/session.php on line 11Warning: session_start(): Cannot start session when headers already sent in /(domain_name_deleted)/httpd.www/system/library/session.php on line 12
Any idea what is the problem and how to get it working?
Thank you in advance
Tom
To resolve you could do one of the following.
1. Switch off display error in the OpenCart settings and the display_errors setting of your php.ini. These should be off for a live store anyway. You could also switch off showing Deprecated notices. http://php.net/manual/en/errorfunc.conf ... -reporting
Be warned that a later version of PHP may remove the function completely and therefore stop working.
2. See if the extension author has update the extension to use a later version of the Dompdf PDF generator library.
3. Upgrade the library to a later version yourself or through a developer and fix any compatibility problems.
NOT all v.1.5.6.x Version Extensions will function under PHP-7.2x, and a
typical sample is this (otherways very needy) one, which refuses to further
function, as it comes by default:
Web Filemanager for OpenCart
https://www.opencart.com/index.php?rout ... n_id=20624
---
But I am testing a 1.5.6.5_rc Version, equipped with a steady raising amount of VqMod Extensions,
in addition to a bunch of additional Modules, and not one of them produced any PHP Version -
related Errors. So, it's not really a wide-spread problem, but one needs to be aware of it, in
'certain' Module/VqMod - Cases at least, possibly also with the PDF Add-On you use.
Ernie
PS: But I would probably NOT use an OC this way, but rather implement the whole works,
exept for VqModded ON/OFF Switches, into a 'final' Source, to so have everything built-in
by Default. It would make it mucho easier, to then add another range of VqMods,
without the need, to check, which one of the existing VqMods might include something,
keeping a new one from doing it's job.


On the other hand, for testing purposes, VqMod is just a great thing to have. But it's
getting quite hard, after a while, to keep track of everything ...

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'800+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.
Has anyone running it yet, is there any changes that needs to be made? I have read some threads about mcrypt but not for version 2.2.0.0?
My wordpress installs have niggled me to upgrade to PHP 7. I can change it on Cpanel but just wanted to make sure.
Opencart 1.5.6.4 & PHP 7 - PHP 7.2
https://www.opencart.com/index.php?rout ... n_id=34428
---
This one uses the OcMod installer, to make it work:
PHP 7.x support for OC v.2.3.0.2 up to PHP 7.3:
https://www.opencart.com/index.php?rout ... n_id=35487
I replaced/inserted that Code in the encryption.php file directly, and it seems to function with v.1.5.6.x as well,
without the need of one more Extension:
Code: Select all
<?php
final class Encryption {
private $key;
public function __construct($key) {
$this->key = $key;
}
public function encrypt($value) {
return strtr(base64_encode(openssl_encrypt($value, 'aes-128-cbc', hash('sha256', $this->key, true))), '+/=', '-_,');
}
public function decrypt($value) {
return trim(openssl_decrypt(base64_decode(strtr($value, '-_,', '+/=')), 'aes-128-cbc', hash('sha256', $this->key, true)));
}
}
?>
Ernie
viewtopic.php?f=179&t=202581#p753726
Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'800+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.
by Use of PHP v.7.4.13, in my OC v.1.5.6.4 /1.5.6.5 type Installations, and all seem
to work with PHP v.7.4.13, in an unsecured HTTP:// Environment so far. But I cannot
judge on Security, possibly, one of the Pro's could share some 'inside-view' on such ...

Ernie
---
encryption.php 1
Code: Select all
<?php
final class Encryption {
public function encrypt($key, $value) {
return strtr(base64_encode(openssl_encrypt($value, 'aes-128-cbc', hash('sha256', $key, true))), '+/=', '-_,');
}
public function decrypt($key, $value) {
return trim(openssl_decrypt(base64_decode(strtr($value, '-_,', '+/=')), 'aes-128-cbc', hash('sha256', $key, true)));
}
}
?>
Code: Select all
<?php
final class Encryption {
public function encrypt($key, $value) {
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
return strtr(base64_encode($nonce . sodium_crypto_secretbox($value, $nonce, hash('sha256', $key, true))), '+/=', '-_,');
}
public function decrypt($key, $value) {
$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', $key, true)));
}
}
?>
Code: Select all
<?php
final class Encryption {
public function encrypt($key, $value) {
$encryption_key = base64_decode($value);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-gcm'));
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);
return base64_encode($encrypted . '::' . $iv);
}
}
public function decrypt($key, $value) {
if (in_array('aes-256-gcm', openssl_get_cipher_methods())) {
$encryption_key = base64_decode($value);
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);
}
}
}
?>
Code: Select all
<?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);
}
}
?>
Attachments
php_7_4_12.png (14.58 KiB) Viewed 165 times
Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'800+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.
Users browsing this forum: No registered users and 9 guests