修改银联支付有关的证书配置路径为相对路径
Code Review By Rock Zhang
Showing
5 changed files
with
16 additions
and
16 deletions
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | function EncryptedPin($sPin, $sCardNo ,$sPubKeyURL) | 3 | function EncryptedPin($sPin, $sCardNo ,$sPubKeyURL) |
4 | { | 4 | { |
5 | global $log; | 5 | global $log; |
6 | - $sPubKeyURL = trim(SDK_ENCRYPT_CERT_PATH," "); | 6 | + $sPubKeyURL = trim(dirname(__FILE__) . '/../../' . SDK_ENCRYPT_CERT_PATH," "); |
7 | // $log->LogInfo("DisSpaces : " . PubKeyURL); | 7 | // $log->LogInfo("DisSpaces : " . PubKeyURL); |
8 | $fp = fopen($sPubKeyURL, "r"); | 8 | $fp = fopen($sPubKeyURL, "r"); |
9 | if ($fp != NULL) | 9 | if ($fp != NULL) |
@@ -23,7 +23,7 @@ function sign(&$params) | @@ -23,7 +23,7 @@ function sign(&$params) | ||
23 | $params_sha1x16 = sha1($params_str, FALSE); | 23 | $params_sha1x16 = sha1($params_str, FALSE); |
24 | $log->LogInfo("摘要sha1x16 >" . $params_sha1x16); | 24 | $log->LogInfo("摘要sha1x16 >" . $params_sha1x16); |
25 | // 签名证书路径 | 25 | // 签名证书路径 |
26 | - $cert_path = SDK_SIGN_CERT_PATH; | 26 | + $cert_path = dirname(__FILE__) . '/../../' . SDK_SIGN_CERT_PATH; |
27 | $private_key = getPrivateKey($cert_path); | 27 | $private_key = getPrivateKey($cert_path); |
28 | // 签名 | 28 | // 签名 |
29 | $sign_falg = openssl_sign($params_sha1x16, $signature, $private_key, OPENSSL_ALGO_SHA1); | 29 | $sign_falg = openssl_sign($params_sha1x16, $signature, $private_key, OPENSSL_ALGO_SHA1); |
@@ -74,7 +74,7 @@ function getPulbicKeyByCertId($certId) | @@ -74,7 +74,7 @@ function getPulbicKeyByCertId($certId) | ||
74 | $log = new PhpLog (SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL); | 74 | $log = new PhpLog (SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL); |
75 | $log->LogInfo('报文返回的证书ID>' . $certId); | 75 | $log->LogInfo('报文返回的证书ID>' . $certId); |
76 | // 证书目录 | 76 | // 证书目录 |
77 | - $cert_dir = SDK_VERIFY_CERT_DIR; | 77 | + $cert_dir = dirname(__FILE__) . '/../../' . SDK_VERIFY_CERT_DIR; |
78 | $log->LogInfo('验证签名证书目录 :>' . $cert_dir); | 78 | $log->LogInfo('验证签名证书目录 :>' . $cert_dir); |
79 | $handle = opendir($cert_dir); | 79 | $handle = opendir($cert_dir); |
80 | if ($handle) { | 80 | if ($handle) { |
@@ -145,7 +145,7 @@ function getSignCertId() | @@ -145,7 +145,7 @@ function getSignCertId() | ||
145 | function getEncryptCertId() | 145 | function getEncryptCertId() |
146 | { | 146 | { |
147 | // 签名证书路径 | 147 | // 签名证书路径 |
148 | - return getCertIdByCerPath(SDK_ENCRYPT_CERT_PATH); | 148 | + return getCertIdByCerPath(dirname(__FILE__) . '/../../' . SDK_ENCRYPT_CERT_PATH); |
149 | } | 149 | } |
150 | 150 | ||
151 | /** | 151 | /** |
@@ -195,7 +195,7 @@ function encryptPan($pan) | @@ -195,7 +195,7 @@ function encryptPan($pan) | ||
195 | */ | 195 | */ |
196 | function encryptPin($pan, $pwd) | 196 | function encryptPin($pan, $pwd) |
197 | { | 197 | { |
198 | - $cert_path = SDK_ENCRYPT_CERT_PATH; | 198 | + $cert_path = dirname(__FILE__) . '/../../' . SDK_ENCRYPT_CERT_PATH; |
199 | $public_key = getPublicKey($cert_path); | 199 | $public_key = getPublicKey($cert_path); |
200 | 200 | ||
201 | return EncryptedPin($pwd, $pan, $public_key); | 201 | return EncryptedPin($pwd, $pan, $public_key); |
@@ -209,7 +209,7 @@ function encryptPin($pan, $pwd) | @@ -209,7 +209,7 @@ function encryptPin($pan, $pwd) | ||
209 | */ | 209 | */ |
210 | function encryptCvn2($cvn2) | 210 | function encryptCvn2($cvn2) |
211 | { | 211 | { |
212 | - $cert_path = SDK_ENCRYPT_CERT_PATH; | 212 | + $cert_path = dirname(__FILE__) . '/../../' . SDK_ENCRYPT_CERT_PATH; |
213 | $public_key = getPublicKey($cert_path); | 213 | $public_key = getPublicKey($cert_path); |
214 | 214 | ||
215 | openssl_public_encrypt($cvn2, $crypted, $public_key); | 215 | openssl_public_encrypt($cvn2, $crypted, $public_key); |
@@ -225,7 +225,7 @@ function encryptCvn2($cvn2) | @@ -225,7 +225,7 @@ function encryptCvn2($cvn2) | ||
225 | */ | 225 | */ |
226 | function encryptDate($certDate) | 226 | function encryptDate($certDate) |
227 | { | 227 | { |
228 | - $cert_path = SDK_ENCRYPT_CERT_PATH; | 228 | + $cert_path = dirname(__FILE__) . '/../../' . SDK_ENCRYPT_CERT_PATH; |
229 | $public_key = getPublicKey($cert_path); | 229 | $public_key = getPublicKey($cert_path); |
230 | 230 | ||
231 | openssl_public_encrypt($certDate, $crypted, $public_key); | 231 | openssl_public_encrypt($certDate, $crypted, $public_key); |
@@ -241,7 +241,7 @@ function encryptDate($certDate) | @@ -241,7 +241,7 @@ function encryptDate($certDate) | ||
241 | */ | 241 | */ |
242 | function encryptDateType($certDataType) | 242 | function encryptDateType($certDataType) |
243 | { | 243 | { |
244 | - $cert_path = SDK_ENCRYPT_CERT_PATH; | 244 | + $cert_path = dirname(__FILE__) . '/../../' . SDK_ENCRYPT_CERT_PATH; |
245 | $public_key = getPublicKey($cert_path); | 245 | $public_key = getPublicKey($cert_path); |
246 | 246 | ||
247 | openssl_public_encrypt($certDataType, $crypted, $public_key); | 247 | openssl_public_encrypt($certDataType, $crypted, $public_key); |
@@ -14,7 +14,7 @@ class Service extends PayAbstract | @@ -14,7 +14,7 @@ class Service extends PayAbstract | ||
14 | 14 | ||
15 | public function __construct(array $paymentParams) | 15 | public function __construct(array $paymentParams) |
16 | { | 16 | { |
17 | - $env = APPLICATION_ENV == 'production' ? 'release' : 'test'; | 17 | + $env = (APPLICATION_ENV === 'production' || APPLICATION_ENV === 'preview') ? 'release' : 'test'; |
18 | include_once 'conf/' . $env . '/SDKConfig.php'; | 18 | include_once 'conf/' . $env . '/SDKConfig.php'; |
19 | include_once 'Func/common.php'; | 19 | include_once 'Func/common.php'; |
20 | include_once 'Func/secureUtil.php'; | 20 | include_once 'Func/secureUtil.php'; |
@@ -11,19 +11,19 @@ const SDK_PAN_ENC = 0; | @@ -11,19 +11,19 @@ const SDK_PAN_ENC = 0; | ||
11 | 11 | ||
12 | 12 | ||
13 | // 签名证书路径 (联系运营获取两码,在CFCA网站下载后配置,自行设置证书密码并配置) | 13 | // 签名证书路径 (联系运营获取两码,在CFCA网站下载后配置,自行设置证书密码并配置) |
14 | -const SDK_SIGN_CERT_PATH = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/release/certs/pc_online_banking.pfx'; | 14 | +const SDK_SIGN_CERT_PATH = 'conf/release/certs/pc_online_banking.pfx'; |
15 | 15 | ||
16 | // 签名证书密码 | 16 | // 签名证书密码 |
17 | const SDK_SIGN_CERT_PWD = 'yoho12'; | 17 | const SDK_SIGN_CERT_PWD = 'yoho12'; |
18 | 18 | ||
19 | // 验签证书 | 19 | // 验签证书 |
20 | -const SDK_VERIFY_CERT_PATH = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/release/certs/UpopRsaCert.cer'; | 20 | +const SDK_VERIFY_CERT_PATH = 'conf/release/certs/UpopRsaCert.cer'; |
21 | 21 | ||
22 | // 密码加密证书 | 22 | // 密码加密证书 |
23 | -const SDK_ENCRYPT_CERT_PATH = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/release/certs/RSA2048_PROD_index_22.cer'; | 23 | +const SDK_ENCRYPT_CERT_PATH = 'conf/release/certs/RSA2048_PROD_index_22.cer'; |
24 | 24 | ||
25 | // 验签证书路径 | 25 | // 验签证书路径 |
26 | -const SDK_VERIFY_CERT_DIR = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/release/certs/'; | 26 | +const SDK_VERIFY_CERT_DIR = 'conf/release/certs/'; |
27 | 27 | ||
28 | // 前台请求地址 | 28 | // 前台请求地址 |
29 | const SDK_FRONT_TRANS_URL = 'https://gateway.95516.com/gateway/api/frontTransReq.do'; | 29 | const SDK_FRONT_TRANS_URL = 'https://gateway.95516.com/gateway/api/frontTransReq.do'; |
@@ -9,17 +9,17 @@ const SDK_PAN_ENC = 0; | @@ -9,17 +9,17 @@ const SDK_PAN_ENC = 0; | ||
9 | // ######(以下配置为PM环境:入网测试环境用,生产环境配置见文档说明)####### | 9 | // ######(以下配置为PM环境:入网测试环境用,生产环境配置见文档说明)####### |
10 | // 签名证书路径 | 10 | // 签名证书路径 |
11 | //const SDK_SIGN_CERT_PATH = 'D:\\wamp\\www\\yohobuy\\library\\WebPlugin\\Pay\\Unionpayweb\\conf\\test\\certs\\PM_700000000000001_acp.pfx'; | 11 | //const SDK_SIGN_CERT_PATH = 'D:\\wamp\\www\\yohobuy\\library\\WebPlugin\\Pay\\Unionpayweb\\conf\\test\\certs\\PM_700000000000001_acp.pfx'; |
12 | -const SDK_SIGN_CERT_PATH = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/test/certs/PM_700000000000001_acp.pfx'; | 12 | +const SDK_SIGN_CERT_PATH = 'conf/test/certs/PM_700000000000001_acp.pfx'; |
13 | 13 | ||
14 | // 签名证书密码 | 14 | // 签名证书密码 |
15 | const SDK_SIGN_CERT_PWD = '000000'; | 15 | const SDK_SIGN_CERT_PWD = '000000'; |
16 | 16 | ||
17 | // 密码加密证书(这条用不到的请随便配) | 17 | // 密码加密证书(这条用不到的请随便配) |
18 | -const SDK_ENCRYPT_CERT_PATH = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/test/certs/verify_sign_acp.cer'; | 18 | +const SDK_ENCRYPT_CERT_PATH = 'conf/test/certs/verify_sign_acp.cer'; |
19 | //const SDK_ENCRYPT_CERT_PATH = 'D:\\wamp\\www\\yohobuy\\library\\WebPlugin\\Pay\\Unionpayweb\\conf\\test\\certs\\verify_sign_acp.cer'; | 19 | //const SDK_ENCRYPT_CERT_PATH = 'D:\\wamp\\www\\yohobuy\\library\\WebPlugin\\Pay\\Unionpayweb\\conf\\test\\certs\\verify_sign_acp.cer'; |
20 | 20 | ||
21 | // 验签证书路径(请配到文件夹,不要配到具体文件) | 21 | // 验签证书路径(请配到文件夹,不要配到具体文件) |
22 | -const SDK_VERIFY_CERT_DIR = '/Data/code/git/web/yohobuy/library/WebPlugin/Pay/Unionpayweb/conf/test/certs/'; | 22 | +const SDK_VERIFY_CERT_DIR = 'conf/test/certs/'; |
23 | 23 | ||
24 | // 前台请求地址 | 24 | // 前台请求地址 |
25 | const SDK_FRONT_TRANS_URL = 'https://101.231.204.80:5000/gateway/api/frontTransReq.do'; | 25 | const SDK_FRONT_TRANS_URL = 'https://101.231.204.80:5000/gateway/api/frontTransReq.do'; |
-
Please register or login to post a comment