diff --git a/adm/config_form.php b/adm/config_form.php index 8629cd087..016355d11 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -1466,10 +1466,14 @@ if($config['cf_cert_use']) { // kcp일 때 if($config['cf_cert_hp'] == 'kcp') { - if(PHP_INT_MAX == 2147483647) // 32-bit - $exe = G5_KCPCERT_PATH . '/bin/ct_cli'; - else - $exe = G5_KCPCERT_PATH . '/bin/ct_cli_x64'; + if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + if(PHP_INT_MAX == 2147483647) // 32-bit + $exe = G5_KCPCERT_PATH . '/bin/ct_cli'; + else + $exe = G5_KCPCERT_PATH . '/bin/ct_cli_x64'; + } else { + $exe = G5_KCPCERT_PATH . '/bin/ct_cli_exe.exe'; + } echo module_exec_check($exe, 'ct_cli'); } diff --git a/plugin/kcpcert/bin/ct_cli_exe.exe b/plugin/kcpcert/bin/ct_cli_exe.exe new file mode 100644 index 000000000..3abbd50c0 Binary files /dev/null and b/plugin/kcpcert/bin/ct_cli_exe.exe differ diff --git a/plugin/kcpcert/kcpcert_result.php b/plugin/kcpcert/kcpcert_result.php index 5468267ae..49345f89c 100644 --- a/plugin/kcpcert/kcpcert_result.php +++ b/plugin/kcpcert/kcpcert_result.php @@ -100,11 +100,15 @@ if( $cert_enc_use == "Y" ) if ( $ct_cert->check_valid_hash ( $home_dir , $dn_hash , $veri_str ) != "1" ) { - // 검증 실패시 처리 영역 - if(PHP_INT_MAX == 2147483647) // 32-bit - $bin_exe = '/bin/ct_cli'; - else - $bin_exe = '/bin/ct_cli_x64'; + if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + // 검증 실패시 처리 영역 + if(PHP_INT_MAX == 2147483647) // 32-bit + $bin_exe = '/bin/ct_cli'; + else + $bin_exe = '/bin/ct_cli_x64'; + } else { + $bin_exe = '/bin/ct_cli_exe.exe'; + } echo "dn_hash 변조 위험있음 (".G5_KCPCERT_PATH.$bin_exe." 파일에 실행권한이 있는지 확인하세요.)"; exit; @@ -133,6 +137,13 @@ if( $cert_enc_use == "Y" ) $dec_res_cd = $ct_cert->mf_get_key_value("res_cd" ); // 암호화된 결과코드 $dec_mes_msg = $ct_cert->mf_get_key_value("res_msg" ); // 암호화된 결과메시지 + if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && function_exists('mb_detect_encoding') ){ + if( mb_detect_encoding($user_name, 'EUC-KR') === 'EUC-KR' ){ + $user_name = iconv_utf8($user_name); + $dec_mes_msg = iconv_utf8($dec_mes_msg); + } + } + // 정상인증인지 체크 if(!$phone_no) alert_close("정상적인 인증이 아닙니다. 올바른 방법으로 이용해 주세요."); diff --git a/plugin/kcpcert/lib/ct_cli_lib.php b/plugin/kcpcert/lib/ct_cli_lib.php index 77c629bd3..bc29ad013 100644 --- a/plugin/kcpcert/lib/ct_cli_lib.php +++ b/plugin/kcpcert/lib/ct_cli_lib.php @@ -22,11 +22,14 @@ class C_CT_CLI // hash 처리 영역 function make_hash_data( $home_dir , $str ) { - if(PHP_INT_MAX == 2147483647) // 32-bit - $bin_exe = $home_dir . '/bin/ct_cli'; - else - $bin_exe = $home_dir . '/bin/ct_cli_x64'; - + if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + if(PHP_INT_MAX == 2147483647) // 32-bit + $bin_exe = $home_dir . '/bin/ct_cli'; + else + $bin_exe = $home_dir . '/bin/ct_cli_x64'; + } else { + $bin_exe = $home_dir . '/bin/ct_cli_exe.exe'; + } $hash_data = $this -> mf_exec( $bin_exe , "lf_CT_CLI__make_hash_data", $str @@ -40,11 +43,14 @@ class C_CT_CLI // dn_hash 체크 함수 function check_valid_hash ($home_dir , $hash_data , $str ) { - if(PHP_INT_MAX == 2147483647) // 32-bit - $bin_exe = $home_dir . '/bin/ct_cli'; - else - $bin_exe = $home_dir . '/bin/ct_cli_x64'; - + if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + if(PHP_INT_MAX == 2147483647) // 32-bit + $bin_exe = $home_dir . '/bin/ct_cli'; + else + $bin_exe = $home_dir . '/bin/ct_cli_x64'; + } else { + $bin_exe = $home_dir . '/bin/ct_cli_exe.exe'; + } $ret_val = $this -> mf_exec( $bin_exe , "lf_CT_CLI__check_valid_hash" , $hash_data , @@ -59,18 +65,31 @@ class C_CT_CLI // 암호화 인증데이터 복호화 function decrypt_enc_cert ( $home_dir, $site_cd , $cert_no , $enc_cert_data , $opt) { - if(PHP_INT_MAX == 2147483647) // 32-bit - $bin_exe = $home_dir . '/bin/ct_cli'; - else - $bin_exe = $home_dir . '/bin/ct_cli_x64'; + if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + if(PHP_INT_MAX == 2147483647) // 32-bit + $bin_exe = $home_dir . '/bin/ct_cli'; + else + $bin_exe = $home_dir . '/bin/ct_cli_x64'; + + $dec_data = $this -> mf_exec( $bin_exe , + "lf_CT_CLI__decrypt_enc_cert" , + $site_cd , + $cert_no , + $enc_cert_data , + $opt + ); + + } else { + $bin_exe = $home_dir . '/bin/ct_cli_exe.exe'; + + $dec_data = $this -> mf_exec( $bin_exe , + "lf_CT_CLI__decrypt_enc_cert" , + $site_cd , + $cert_no , + $enc_cert_data + ); + } - $dec_data = $this -> mf_exec( $bin_exe , - "lf_CT_CLI__decrypt_enc_cert" , - $site_cd , - $cert_no , - $enc_cert_data , - $opt - ); if ( $dec_data == "" ) { $dec_data = "HS03"; }