NHN_KCP 휴대폰 본인인증 인증키 입력없이 사용할수 있도록 적용
This commit is contained in:
@ -418,6 +418,8 @@ if (!isset($config['cf_cert_kcp_enckey'])) {
|
||||
$sql = "ALTER TABLE `{$g5['config_table']}`
|
||||
ADD COLUMN `cf_cert_kcp_enckey` VARCHAR(100) NOT NULL DEFAULT '' AFTER `cf_cert_kcp_cd`; ";
|
||||
sql_query($sql, false);
|
||||
|
||||
$config['cf_cert_kcp_enckey'] = '';
|
||||
}
|
||||
|
||||
if (!$config['cf_faq_skin']) {
|
||||
@ -1075,7 +1077,7 @@ if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||
<tr>
|
||||
<th scope="row" class="cf_cert_service"><label for="cf_cert_kcp_enckey">NHN KCP 가맹점 인증키</label></th>
|
||||
<td class="cf_cert_service">
|
||||
<?php echo help('NHN_KCP 상점관리자 > 기술관리센터 > 인증센터 > 가맹점 인증키관리 에서 인증키 발급 후에 인증키 정보를 입력해 주세요.<br>입력하지 않거나 잘못 입력시 휴대폰 본인확인을 취소 하셨습니다. 라고 메시지가 나오면서 창이 닫히는 오류가 발생됩니다.') ?>
|
||||
<?php echo help('(선택사항, 추후 NHN_KCP 상점관리자에서 인증키 발급 메뉴 오픈일정 이후부터 적용되는 내용입니다.)<br>NHN_KCP 상점관리자 > 기술관리센터 > 인증센터 > 가맹점 인증키관리 에서 인증키 발급 후에 인증키 정보를 입력') ?>
|
||||
<input type="text" name="cf_cert_kcp_enckey" value="<?php echo get_sanitize_input($config['cf_cert_kcp_enckey']); ?>" id="cf_cert_kcp_enckey" class="frm_input" maxlength="100" size="40"> <a href="https://partner.kcp.co.kr" target="_blank" class="btn_frmline">NHN KCP 상점관리자</a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1682,16 +1684,19 @@ if ($config['cf_cert_use']) {
|
||||
|
||||
// kcp일 때
|
||||
if ($config['cf_cert_hp'] == 'kcp') {
|
||||
|
||||
$bin_path = ((int)$config['cf_cert_use'] === 2 && !$config['cf_cert_kcp_enckey']) ? 'bin_old' : 'bin';
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
if (PHP_INT_MAX == 2147483647) { // 32-bit
|
||||
$exe = G5_KCPCERT_PATH . '/bin/ct_cli';
|
||||
$exe = G5_KCPCERT_PATH . '/'.$bin_path.'/ct_cli';
|
||||
} else {
|
||||
$exe = G5_KCPCERT_PATH . '/bin/ct_cli_x64';
|
||||
$exe = G5_KCPCERT_PATH . '/'.$bin_path.'/ct_cli_x64';
|
||||
}
|
||||
} else {
|
||||
$exe = G5_KCPCERT_PATH . '/bin/ct_cli_exe.exe';
|
||||
$exe = G5_KCPCERT_PATH . '/'.$bin_path.'/ct_cli_exe.exe';
|
||||
}
|
||||
|
||||
|
||||
echo module_exec_check($exe, 'ct_cli');
|
||||
}
|
||||
|
||||
|
||||
BIN
plugin/kcpcert/bin_old/ct_cli
Executable file
BIN
plugin/kcpcert/bin_old/ct_cli
Executable file
Binary file not shown.
BIN
plugin/kcpcert/bin_old/ct_cli_exe.exe
Normal file
BIN
plugin/kcpcert/bin_old/ct_cli_exe.exe
Normal file
Binary file not shown.
BIN
plugin/kcpcert/bin_old/ct_cli_x64
Executable file
BIN
plugin/kcpcert/bin_old/ct_cli_x64
Executable file
Binary file not shown.
@ -68,6 +68,11 @@ for($i=0; $i<count($key); $i++)
|
||||
$enc_cert_data = f_get_parm_str ( $valParam );
|
||||
}
|
||||
|
||||
if ( $nmParam == "enc_cert_data2" )
|
||||
{
|
||||
$enc_cert_data2 = f_get_parm_str ( $valParam );
|
||||
}
|
||||
|
||||
if ( $nmParam == "dn_hash" )
|
||||
{
|
||||
$dn_hash = f_get_parm_str ( $valParam );
|
||||
@ -97,17 +102,25 @@ if( $cert_enc_use == "Y" )
|
||||
// KCP 가 리턴해 드리는 dn_hash 와 사이트 코드, 주문번호 , 인증번호를 검증하여
|
||||
// 해당 데이터의 위변조를 방지합니다
|
||||
$veri_str = $site_cd.$ordr_idxx.$cert_no; // 사이트 코드 + 주문번호 + 인증거래번호
|
||||
|
||||
if ( $ct_cert->check_valid_hash ( $home_dir , $dn_hash , $veri_str ) != "1" )
|
||||
|
||||
$enc_cert_real_data = $enc_cert_data2;
|
||||
$bin_path = 'bin';
|
||||
|
||||
if ((int)$config['cf_cert_use'] === 2 && !$config['cf_cert_kcp_enckey']) {
|
||||
$bin_path = 'bin_old';
|
||||
$enc_cert_real_data = $enc_cert_data;
|
||||
}
|
||||
|
||||
if ( $ct_cert->check_valid_hash ( $home_dir , $kcp_enc_key, $dn_hash , $veri_str ) != "1" )
|
||||
{
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
// 검증 실패시 처리 영역
|
||||
if(PHP_INT_MAX == 2147483647) // 32-bit
|
||||
$bin_exe = '/bin/ct_cli';
|
||||
$bin_exe = '/'.$bin_path.'/ct_cli';
|
||||
else
|
||||
$bin_exe = '/bin/ct_cli_x64';
|
||||
$bin_exe = '/'.$bin_path.'/ct_cli_x64';
|
||||
} else {
|
||||
$bin_exe = '/bin/ct_cli_exe.exe';
|
||||
$bin_exe = '/'.$bin_path.'/ct_cli_exe.exe';
|
||||
}
|
||||
|
||||
echo "dn_hash 변조 위험있음 (".G5_KCPCERT_PATH.$bin_exe." 파일에 실행권한이 있는지 확인하세요.)";
|
||||
@ -116,13 +129,13 @@ if( $cert_enc_use == "Y" )
|
||||
}
|
||||
|
||||
// 가맹점 DB 처리 페이지 영역
|
||||
|
||||
|
||||
// 인증데이터 복호화 함수
|
||||
// 해당 함수는 암호화된 enc_cert_data 를
|
||||
// site_cd 와 cert_no 를 가지고 복화화 하는 함수 입니다.
|
||||
// 정상적으로 복호화 된경우에만 인증데이터를 가져올수 있습니다.
|
||||
$opt = "1" ; // 복호화 인코딩 옵션 ( UTF - 8 사용시 "1" )
|
||||
$ct_cert->decrypt_enc_cert( $home_dir , $site_cd , $cert_no , $enc_cert_data , $opt );
|
||||
$ct_cert->decrypt_enc_cert( $home_dir , $kcp_enc_key, $site_cd , $cert_no , $enc_cert_real_data , $opt );
|
||||
|
||||
$comm_id = $ct_cert->mf_get_key_value("comm_id" ); // 이동통신사 코드
|
||||
$phone_no = $ct_cert->mf_get_key_value("phone_no" ); // 전화번호
|
||||
|
||||
@ -90,9 +90,6 @@ $ct_cert->mf_clear();
|
||||
<!-- cert_enc_use 필수 (고정값 : 메뉴얼 참고) -->
|
||||
<input type="hidden" name="cert_enc_use" value="Y"/>
|
||||
|
||||
<!-- 리턴 암호화 고도화 -->
|
||||
<input type="hidden" name="cert_enc_use_ext" value="Y"/>
|
||||
|
||||
<?php if(is_mobile()) { ?>
|
||||
<!-- cert_able_yn input 비활성화 설정 -->
|
||||
<input type="hidden" name="cert_able_yn" value=""/>
|
||||
@ -114,7 +111,11 @@ $ct_cert->mf_clear();
|
||||
<input type="hidden" name="param_opt_2" value="opt2"/>
|
||||
<input type="hidden" name="param_opt_3" value="opt3"/>
|
||||
|
||||
<?php if ($config['cf_cert_kcp_enckey']) { ?>
|
||||
<!-- 리턴 암호화 고도화 -->
|
||||
<input type="hidden" name="cert_enc_use_ext" value="Y"/>
|
||||
<input type='hidden' name='kcp_cert_lib_ver' value="<?php echo $ct_cert->get_kcp_lib_ver( $home_dir ); ?>"/>
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
@ -104,16 +104,24 @@ if( $cert_enc_use == "Y" )
|
||||
// 해당 데이터의 위변조를 방지합니다
|
||||
$veri_str = $site_cd.$ordr_idxx.$cert_no; // 사이트 코드 + 주문번호 + 인증거래번호
|
||||
|
||||
$enc_cert_real_data = $enc_cert_data2;
|
||||
$bin_path = 'bin';
|
||||
|
||||
if ((int)$config['cf_cert_use'] === 2 && !$config['cf_cert_kcp_enckey']) {
|
||||
$bin_path = 'bin_old';
|
||||
$enc_cert_real_data = $enc_cert_data;
|
||||
}
|
||||
|
||||
if ( $ct_cert->check_valid_hash ( $home_dir , $kcp_enc_key, $dn_hash , $veri_str ) != "1" )
|
||||
{
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
// 검증 실패시 처리 영역
|
||||
if(PHP_INT_MAX == 2147483647) // 32-bit
|
||||
$bin_exe = '/bin/ct_cli';
|
||||
$bin_exe = '/'.$bin_path.'/ct_cli';
|
||||
else
|
||||
$bin_exe = '/bin/ct_cli_x64';
|
||||
$bin_exe = '/'.$bin_path.'/ct_cli_x64';
|
||||
} else {
|
||||
$bin_exe = '/bin/ct_cli_exe.exe';
|
||||
$bin_exe = '/'.$bin_path.'/ct_cli_exe.exe';
|
||||
}
|
||||
|
||||
echo "dn_hash 변조 위험있음 (".G5_KCPCERT_PATH.$bin_exe." 파일에 실행권한이 있는지 확인하세요.)";
|
||||
@ -122,13 +130,13 @@ if( $cert_enc_use == "Y" )
|
||||
}
|
||||
|
||||
// 가맹점 DB 처리 페이지 영역
|
||||
|
||||
|
||||
// 인증데이터 복호화 함수
|
||||
// 해당 함수는 암호화된 enc_cert_data 를
|
||||
// site_cd 와 cert_no 를 가지고 복화화 하는 함수 입니다.
|
||||
// 정상적으로 복호화 된경우에만 인증데이터를 가져올수 있습니다.
|
||||
$opt = "1" ; // 복호화 인코딩 옵션 ( UTF - 8 사용시 "1" )
|
||||
$ct_cert->decrypt_enc_cert( $home_dir , $kcp_enc_key, $site_cd , $cert_no , $enc_cert_data2 , $opt );
|
||||
$ct_cert->decrypt_enc_cert( $home_dir , $kcp_enc_key, $site_cd , $cert_no , $enc_cert_real_data , $opt );
|
||||
|
||||
$comm_id = $ct_cert->mf_get_key_value("comm_id" ); // 이동통신사 코드
|
||||
$phone_no = $ct_cert->mf_get_key_value("phone_no" ); // 전화번호
|
||||
|
||||
@ -18,23 +18,39 @@ class C_CT_CLI
|
||||
{
|
||||
$this->m_dec_data="";
|
||||
}
|
||||
|
||||
|
||||
function get_bin_dirname()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$bin_path = ((int)$config['cf_cert_use'] === 2 && !$config['cf_cert_kcp_enckey']) ? 'bin_old' : 'bin';
|
||||
|
||||
return $bin_path;
|
||||
}
|
||||
// hash 처리 영역
|
||||
function make_hash_data( $home_dir , $key , $str )
|
||||
{
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
if(PHP_INT_MAX == 2147483647) // 32-bit
|
||||
$bin_exe = $home_dir . '/bin/ct_cli';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli';
|
||||
else
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_x64';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_x64';
|
||||
} else {
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_exe.exe';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_exe.exe';
|
||||
}
|
||||
|
||||
if ($key) {
|
||||
$hash_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__make_hash_data",
|
||||
$key,
|
||||
$str
|
||||
);
|
||||
} else {
|
||||
$hash_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__make_hash_data",
|
||||
$str
|
||||
);
|
||||
}
|
||||
$hash_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__make_hash_data",
|
||||
$key,
|
||||
$str
|
||||
);
|
||||
|
||||
if ( $hash_data == "" ) { $hash_data = "HS01"; }
|
||||
|
||||
@ -46,18 +62,27 @@ class C_CT_CLI
|
||||
{
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
if(PHP_INT_MAX == 2147483647) // 32-bit
|
||||
$bin_exe = $home_dir . '/bin/ct_cli';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli';
|
||||
else
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_x64';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_x64';
|
||||
} else {
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_exe.exe';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_exe.exe';
|
||||
}
|
||||
|
||||
if ($key) {
|
||||
$ret_val = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__check_valid_hash" ,
|
||||
$key,
|
||||
$hash_data ,
|
||||
$str
|
||||
);
|
||||
} else {
|
||||
$ret_val = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__check_valid_hash" ,
|
||||
$hash_data ,
|
||||
$str
|
||||
);
|
||||
}
|
||||
$ret_val = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__check_valid_hash" ,
|
||||
$key,
|
||||
$hash_data ,
|
||||
$str
|
||||
);
|
||||
|
||||
if ( $ret_val == "" ) { $ret_val = "HS02"; }
|
||||
|
||||
@ -69,29 +94,48 @@ class C_CT_CLI
|
||||
{
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
if(PHP_INT_MAX == 2147483647) // 32-bit
|
||||
$bin_exe = $home_dir . '/bin/ct_cli';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli';
|
||||
else
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_x64';
|
||||
|
||||
$dec_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__decrypt_enc_cert" ,
|
||||
$key,
|
||||
$site_cd ,
|
||||
$cert_no ,
|
||||
$enc_cert_data ,
|
||||
$opt
|
||||
);
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_x64';
|
||||
|
||||
if ($key) {
|
||||
$dec_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__decrypt_enc_cert" ,
|
||||
$key,
|
||||
$site_cd ,
|
||||
$cert_no ,
|
||||
$enc_cert_data ,
|
||||
$opt
|
||||
);
|
||||
} else {
|
||||
$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" ,
|
||||
$key,
|
||||
$site_cd ,
|
||||
$cert_no ,
|
||||
$enc_cert_data
|
||||
);
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_exe.exe';
|
||||
|
||||
if ($key) {
|
||||
$dec_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__decrypt_enc_cert" ,
|
||||
$key,
|
||||
$site_cd ,
|
||||
$cert_no ,
|
||||
$enc_cert_data
|
||||
);
|
||||
} else {
|
||||
$dec_data = $this -> mf_exec( $bin_exe ,
|
||||
"lf_CT_CLI__decrypt_enc_cert" ,
|
||||
$site_cd ,
|
||||
$cert_no ,
|
||||
$enc_cert_data
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $dec_data == "" ) { $dec_data = "HS03"; }
|
||||
@ -104,11 +148,11 @@ class C_CT_CLI
|
||||
{
|
||||
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
if(PHP_INT_MAX == 2147483647) // 32-bit
|
||||
$bin_exe = $home_dir . '/bin/ct_cli';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli';
|
||||
else
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_x64';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_x64';
|
||||
} else {
|
||||
$bin_exe = $home_dir . '/bin/ct_cli_exe.exe';
|
||||
$bin_exe = $home_dir . '/'.$this->get_bin_dirname().'/ct_cli_exe.exe';
|
||||
}
|
||||
|
||||
$ver_data = $this -> mf_exec( $bin_exe ,
|
||||
|
||||
Reference in New Issue
Block a user