PHP 7.2

Discuss MySQL Ajax Table Editor Pro Version

PHP 7.2

Postby KarelB » Tue Dec 03, 2019 9:09 am

All,

Anybody ported MATE to PHP 7.2.
It seems the mcrypt module is deprecated in 7.2

Regards

Karel
KarelB
 
Posts: 458
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: PHP 7.2

Postby pq_rar » Fri Dec 06, 2019 2:22 am

changed this in php\AjaxTableEditor.php
Code: Select all
   public function encryptData($message) {
      $key = 'blabla';
      if (mb_strlen($key, '8bit') !== 32) {
         throw new Exception("Needs a 256-bit key!");
      }
      $ivsize = openssl_cipher_iv_length('aes-256-cbc');
      $iv = openssl_random_pseudo_bytes($ivsize);
      
      $ciphertext = openssl_encrypt(
         $message,
         'aes-256-cbc',
         $key,
         OPENSSL_RAW_DATA,
         $iv
      );       
      return $iv . $ciphertext;
   }

   
   public function decryptData($message) {
      $key = 'blabla';
      if (mb_strlen($key, '8bit') !== 32) {
         throw new Exception("Needs a 256-bit key!");
      }
      $ivsize = openssl_cipher_iv_length('aes-256-cbc');
      $iv = mb_substr($message, 0, $ivsize, '8bit');
      $ciphertext = mb_substr($message, $ivsize, null, '8bit');
      
      return openssl_decrypt(
         $ciphertext,
         'aes-256-cbc',
         $key,
         OPENSSL_RAW_DATA,
         $iv
      );
   }   

where blabla key you can generate with: https://randomkeygen.com/
Look for the 256 bit keys at the bottom. At least it is working. Somebody please comment about security on this approach.
pq_rar
 
Posts: 89
Joined: Thu May 27, 2010 4:44 am

Re: PHP 7.2

Postby KarelB » Mon Dec 09, 2019 7:42 am

pq_rar,

Thanks, I will try this.

Karel
KarelB
 
Posts: 458
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands


Return to Pro Version

Who is online

Users browsing this forum: No registered users and 2 guests