1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
require_once dirname(__FILE__).'/WebParamsCrypto.php';
class NicePayHttpServletRequestWrapper{ private $httpRequest; const PRIVATE_ENC_KEY_NAME = 'EncodeKey'; const PRIVATE_ENC_TARGET_NAME = 'EncodeParameters'; public function NicePayHttpServletRequestWrapper($httpRequest){ $this->httpRequest = $httpRequest; $this->initailizeHttpRequestParams(); } private function initailizeHttpRequestParams(){ $httpParamMap = array(); $decryptTargetNames = $this->httpRequest[NicePayHttpServletRequestWrapper::PRIVATE_ENC_TARGET_NAME]; $decryptKeySet = array(); if(isset($decryptTargetNames) && $decryptTargetNames!==""){ $decryptFormNames = explode(",",$decryptTargetNames); foreach($decryptFormNames as $key=>$value){ $decryptKeySet[$key] = $value; } } foreach($this->httpRequest as $key=>$value){ // ¾ÏÈ£ÈµÈ °ÍÀ̹ǷΠº¹È£È ÇØ¾ß µÈ´ç²². if(isset($decryptKeySet) && $this->isTargetDecrypt($key,$decryptKeySet)){ $privateKey = $this->httpRequest[NicePayHttpServletRequestWrapper::PRIVATE_ENC_KEY_NAME]; $webParamCrypto = new WebParamsCrypto($privateKey); $this->httpRequest[$key] = $webParamCrypto->decrypt($value); } } } public function getHttpRequestMap(){ return $this->httpRequest; } private function isTargetDecrypt($formName, $decryptKeySet){ $isEncrypt = false; foreach($decryptKeySet as $key=>$value){ if($formName == $value){ $isEncrypt = true; break; } } return $isEncrypt; } }
?>
|