@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | { |
154 | 154 | $merchant_data = []; |
155 | 155 | |
156 | - foreach ( $this->getData() as $k => $v ) { |
|
157 | - if ( !empty($v) ) { |
|
156 | + foreach ($this->getData() as $k => $v) { |
|
157 | + if (!empty($v)) { |
|
158 | 158 | $merchant_data[$k] = urlencode($v); |
159 | 159 | } |
160 | 160 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $encrypted_data = $cryto->encrypt(http_build_query($merchant_data), $this->getWorkingKey()); |
165 | 165 | |
166 | - $url = $this->getEndpoint() . '&encRequest=' . $encrypted_data . '&access_code=' . $this->getAccessCode(); |
|
166 | + $url = $this->getEndpoint().'&encRequest='.$encrypted_data.'&access_code='.$this->getAccessCode(); |
|
167 | 167 | |
168 | 168 | // echo '<pre>'; print_r([ |
169 | 169 | // 'data' => $this->getData(), |
@@ -6,19 +6,19 @@ |
||
6 | 6 | public function encrypt($plainText, $key) { |
7 | 7 | $method = "AES-256-GCM"; |
8 | 8 | $initVector = openssl_random_pseudo_bytes(16); |
9 | - $openMode = openssl_encrypt( $plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag ); |
|
9 | + $openMode = openssl_encrypt($plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag); |
|
10 | 10 | |
11 | - return bin2hex( $initVector ).bin2hex( $openMode . $tag ); |
|
11 | + return bin2hex($initVector).bin2hex($openMode.$tag); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function decrypt($encryptedText, $key) { |
15 | 15 | $method = 'AES-256-GCM'; |
16 | - $encryptedText = hex2bin( $encryptedText ); |
|
16 | + $encryptedText = hex2bin($encryptedText); |
|
17 | 17 | $iv_len = $tag_length = 16; |
18 | - $iv = substr( $encryptedText, 0, $iv_len ); |
|
19 | - $tag = substr( $encryptedText, -$tag_length, $iv_len ); |
|
20 | - $ciphertext = substr( $encryptedText, $iv_len, -$tag_length ); |
|
18 | + $iv = substr($encryptedText, 0, $iv_len); |
|
19 | + $tag = substr($encryptedText, -$tag_length, $iv_len); |
|
20 | + $ciphertext = substr($encryptedText, $iv_len, -$tag_length); |
|
21 | 21 | |
22 | - return openssl_decrypt( $ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag ); |
|
22 | + return openssl_decrypt($ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |