Plugin Directory

Changeset 1900380


Ignore:
Timestamp:
06/28/2018 07:17:48 AM (8 years ago)
Author:
kagla
Message:

1.3.5 update

Location:
gnupay-inicis/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gnupay-inicis/trunk/config.php

    r1830608 r1900380  
    55    public function __construct() {
    66
    7         define( 'GNUPAY_INICIS_VERSION', '1.3.4' );
     7        define( 'GNUPAY_INICIS_VERSION', '1.3.5' );
    88        define( 'GNUPAY_INICIS', 'gnupay-inicis' );
    99        define( 'GNUPAY_INICIS_ORDER_TMP', '_order_tmp_inicis' );
  • gnupay-inicis/trunk/gnupay-inicis.php

    r1830608 r1900380  
    66 *  Author: SIR Soft
    77 *  Author URI: http://sir.kr
    8  *  Version: 1.3.4
     8 *  Version: 1.3.5
    99 *  Tested up to: 4.5
    1010 *  Text Domain: gnupay-inicis
  • gnupay-inicis/trunk/lib/INICls.php

    r1830608 r1900380  
    914914
    915915        //GOODSINFO
    916         $this->m_RESULT[NM_MOID] = $this->GetXMLData(MOID);
     916        $this->m_RESULT[NM_MOID] = $this->GetXMLData("MOID");
    917917
    918918        //PAYMENTINFO
     
    10691069
    10701070    function ParsePIEncrypted() {
    1071         parse_str($this->m_REQUEST["encrypted"]);
    1072         $this->m_PIPGPubSN = $CertVer;
    1073         $this->m_PG1 = $pg1;
    1074         $this->m_PG2 = $pg2;
    1075         $this->m_PG1IP = $pg1ip;
    1076         $this->m_PG2IP = $pg2ip;
     1071        if (version_compare(PHP_VERSION, '7.1.0', '>=') && function_exists('openssl_encrypt')) {
     1072            parse_str($this->m_REQUEST["encrypted"], $output);
     1073            $this->m_PIPGPubSN = $output['CertVer'];
     1074            $this->m_PG1 = $output['pg1'];
     1075            $this->m_PG2 = $output['pg2'];
     1076            $this->m_PG1IP = $output['pg1ip'];
     1077            $this->m_PG2IP = $output['pg2ip'];
     1078        } else {
     1079            parse_str($this->m_REQUEST["encrypted"]);
     1080            $this->m_PIPGPubSN = $CertVer;
     1081            $this->m_PG1 = $pg1;
     1082            $this->m_PG2 = $pg2;
     1083            $this->m_PG1IP = $pg1ip;
     1084            $this->m_PG2IP = $pg2ip;
     1085        }
    10771086    }
    10781087
     
    12311240    }
    12321241
     1242    //https://stackoverflow.com/questions/42350165/openssl-equivalent-to-mcrypt-get-block-size
     1243    function openssl_cipher_block_length($cipher)
     1244    {
     1245        $ivSize = @openssl_cipher_iv_length($cipher);
     1246
     1247        // Invalid or unsupported cipher.
     1248        if (false === $ivSize) {
     1249            return false;
     1250        }
     1251
     1252        $iv = str_repeat("a", $ivSize);
     1253
     1254        // Loop over possible block sizes, from 1 upto 1024 bytes.
     1255        // The upper limit is arbitrary but high enough that is
     1256        // sufficient for any current & foreseeable cipher.
     1257        for ($size = 1; $size < 1024; $size++) {
     1258            $output = openssl_encrypt(
     1259                // Try varying the length of the raw data
     1260                str_repeat("a", $size),
     1261
     1262                // Cipher to use
     1263                $cipher,
     1264
     1265                // OpenSSL expands the key as necessary,
     1266                // so this value is actually not relevant.
     1267                "a",
     1268
     1269                // Disable data padding: php_openssl will return false
     1270                // if the input data's length is not a multiple
     1271                // of the block size.
     1272                //
     1273                // We also pass OPENSSL_RAW_DATA so that PHP does not
     1274                // base64-encode the data (since we just throw it away
     1275                // afterwards anyway)
     1276                OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING,
     1277
     1278                // Feed it with an IV to avoid nasty warnings.
     1279                // The actual value is not relevant as long as
     1280                // it has the proper length.
     1281                $iv
     1282            );
     1283
     1284            if (false !== $output) {
     1285                return $size;
     1286            }
     1287        }
     1288
     1289        // Could not determine the cipher's block length.
     1290        return false;
     1291    }
     1292
    12331293    function SymmEncrypt($src_data, &$enc_data, $key, $iv) {
    1234         $size = mcrypt_get_block_size(MCRYPT_3DES, MCRYPT_MODE_CBC);
    1235         $src_data = $this->pkcs5_pad($src_data, $size);
    1236         $cipher = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
    1237         mcrypt_generic_init($cipher, $key, $iv);
    1238         $enc_data = mcrypt_generic($cipher, $src_data);
    1239         mcrypt_generic_deinit($cipher);
    1240         mcrypt_module_close($cipher);
     1294        if (version_compare(PHP_VERSION, '7.1.0', '>=') && function_exists('openssl_encrypt')) {
     1295            $size = $this->openssl_cipher_block_length('DES-EDE3-CBC');
     1296           
     1297            if( !$size ){
     1298                $size = 8;
     1299            }
     1300
     1301            $enc_data = openssl_encrypt($this->pkcs5_pad($src_data, $size), 'DES-EDE3-CBC', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $iv);
     1302        } else {
     1303            $size = mcrypt_get_block_size(MCRYPT_3DES, MCRYPT_MODE_CBC);
     1304            $src_data = $this->pkcs5_pad($src_data, $size);
     1305            $cipher = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
     1306            mcrypt_generic_init($cipher, $key, $iv);
     1307            $enc_data = mcrypt_generic($cipher, $src_data);
     1308            mcrypt_generic_deinit($cipher);
     1309            mcrypt_module_close($cipher);
     1310        }
    12411311
    12421312        if (!$enc_data)
     
    12481318
    12491319    function SymmDecrypt($enc_data, &$dec_data, $key, $iv) {
    1250         $cipher = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
    1251         mcrypt_generic_init($cipher, $key, $iv);
    1252         $dec_data = mdecrypt_generic($cipher, $enc_data);
    1253         mcrypt_generic_deinit($cipher);
    1254         mcrypt_module_close($cipher);
     1320        if (version_compare(PHP_VERSION, '7.1.0', '>=') && function_exists('openssl_encrypt')) {
     1321            $dec_data = $this->pkcs5_unpad(openssl_decrypt($enc_data, 'DES-EDE3-CBC', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $iv));
     1322        } else {
     1323            $cipher = mcrypt_module_open(MCRYPT_3DES, '', MCRYPT_MODE_CBC, '');
     1324            mcrypt_generic_init($cipher, $key, $iv);
     1325            $dec_data = mdecrypt_generic($cipher, $enc_data);
     1326            mcrypt_generic_deinit($cipher);
     1327            mcrypt_module_close($cipher);
     1328        }
    12551329
    12561330        if (!$dec_data)
     
    12911365
    12921366    function remove_ctrl($string) {
     1367        /*
    12931368        for ($i = 0; $i < strlen($string); $i++) {
    12941369            $chr = $string{$i};
     
    12991374                $string{$i} = $chr;
    13001375        }
     1376
    13011377        return trim($string);
     1378        */
     1379
     1380        $tmps = array();
     1381
     1382        for ($i = 0; $i < strlen($string); $i++) {
     1383            $chr = substr( $string, $i, 1 );
     1384
     1385            $ord = ord($chr);
     1386            if ($ord < 10)
     1387                $tmps[$i] = '';
     1388            else
     1389                $tmps[$i] = $chr;
     1390        }
     1391        return trim(implode('', $tmps));
    13021392    }
    13031393
  • gnupay-inicis/trunk/readme.txt

    r1830608 r1900380  
    66Requires at least: 4.0
    77Tested up to: 4.5
    8 Stable tag: 1.3.4
     8Stable tag: 1.3.5
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.