Changeset 1900380
- Timestamp:
- 06/28/2018 07:17:48 AM (8 years ago)
- Location:
- gnupay-inicis/trunk
- Files:
-
- 4 edited
-
config.php (modified) (1 diff)
-
gnupay-inicis.php (modified) (1 diff)
-
lib/INICls.php (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gnupay-inicis/trunk/config.php
r1830608 r1900380 5 5 public function __construct() { 6 6 7 define( 'GNUPAY_INICIS_VERSION', '1.3. 4' );7 define( 'GNUPAY_INICIS_VERSION', '1.3.5' ); 8 8 define( 'GNUPAY_INICIS', 'gnupay-inicis' ); 9 9 define( 'GNUPAY_INICIS_ORDER_TMP', '_order_tmp_inicis' ); -
gnupay-inicis/trunk/gnupay-inicis.php
r1830608 r1900380 6 6 * Author: SIR Soft 7 7 * Author URI: http://sir.kr 8 * Version: 1.3. 48 * Version: 1.3.5 9 9 * Tested up to: 4.5 10 10 * Text Domain: gnupay-inicis -
gnupay-inicis/trunk/lib/INICls.php
r1830608 r1900380 914 914 915 915 //GOODSINFO 916 $this->m_RESULT[NM_MOID] = $this->GetXMLData( MOID);916 $this->m_RESULT[NM_MOID] = $this->GetXMLData("MOID"); 917 917 918 918 //PAYMENTINFO … … 1069 1069 1070 1070 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 } 1077 1086 } 1078 1087 … … 1231 1240 } 1232 1241 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 1233 1293 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 } 1241 1311 1242 1312 if (!$enc_data) … … 1248 1318 1249 1319 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 } 1255 1329 1256 1330 if (!$dec_data) … … 1291 1365 1292 1366 function remove_ctrl($string) { 1367 /* 1293 1368 for ($i = 0; $i < strlen($string); $i++) { 1294 1369 $chr = $string{$i}; … … 1299 1374 $string{$i} = $chr; 1300 1375 } 1376 1301 1377 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)); 1302 1392 } 1303 1393 -
gnupay-inicis/trunk/readme.txt
r1830608 r1900380 6 6 Requires at least: 4.0 7 7 Tested up to: 4.5 8 Stable tag: 1.3. 48 Stable tag: 1.3.5 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.