NHN_KCP 윈도우 본인인증 모듈 추가

This commit is contained in:
thisgun
2020-06-01 12:01:23 +09:00
parent c7f1466751
commit f1152df518
4 changed files with 64 additions and 30 deletions

Binary file not shown.

View File

@ -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("정상적인 인증이 아닙니다. 올바른 방법으로 이용해 주세요.");

View File

@ -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"; }