| @@ 468-481 (lines=14) @@ | ||
| 465 | return $decrypted_data; |
|
| 466 | } |
|
| 467 | ||
| 468 | private function encryptOpenSSL($data) {
|
|
| 469 | if ($this->cryptParams['type'] == 'public') {
|
|
| 470 | if (! openssl_public_encrypt($data, $encrypted_data, $this->key, $this->cryptParams['padding'])) {
|
|
| 471 | throw new Exception('Failure encrypting Data');
|
|
| 472 | return; |
|
| 473 | } |
|
| 474 | } else {
|
|
| 475 | if (! openssl_private_encrypt($data, $encrypted_data, $this->key, $this->cryptParams['padding'])) {
|
|
| 476 | throw new Exception('Failure encrypting Data');
|
|
| 477 | return; |
|
| 478 | } |
|
| 479 | } |
|
| 480 | return $encrypted_data; |
|
| 481 | } |
|
| 482 | ||
| 483 | private function decryptOpenSSL($data) {
|
|
| 484 | if ($this->cryptParams['type'] == 'public') {
|
|
| @@ 483-496 (lines=14) @@ | ||
| 480 | return $encrypted_data; |
|
| 481 | } |
|
| 482 | ||
| 483 | private function decryptOpenSSL($data) {
|
|
| 484 | if ($this->cryptParams['type'] == 'public') {
|
|
| 485 | if (! openssl_public_decrypt($data, $decrypted, $this->key, $this->cryptParams['padding'])) {
|
|
| 486 | throw new Exception('Failure decrypting Data');
|
|
| 487 | return; |
|
| 488 | } |
|
| 489 | } else {
|
|
| 490 | if (! openssl_private_decrypt($data, $decrypted, $this->key, $this->cryptParams['padding'])) {
|
|
| 491 | throw new Exception('Failure decrypting Data');
|
|
| 492 | return; |
|
| 493 | } |
|
| 494 | } |
|
| 495 | return $decrypted; |
|
| 496 | } |
|
| 497 | ||
| 498 | private function signOpenSSL($data) {
|
|
| 499 | $algo = OPENSSL_ALGO_SHA1; |
|