Exemplo n.º 1
0
 public function testEncryptData()
 {
     if (!extension_loaded('mcrypt')) {
         $this->markTestSkipped('mcrypt extension is required to test encrypt feature.');
     }
     $sm = new CSecurityManager();
     $sm->encryptionKey = '123456';
     $data = 'this is raw data';
     $encryptedData = $sm->encrypt($data);
     $this->assertTrue($data !== $encryptedData);
     $data2 = $sm->decrypt($encryptedData);
     $this->assertEquals($data, $data2);
 }
Exemplo n.º 2
0
 /**
  * Returns an encrypted string (base64 encoding) to post to our payment processor (KEM payment).
  * @return string encrypted order data to display to the end user (NOT used for payment validation)
  */
 public function encryptedFrontendData()
 {
     $orderdict = $this->frontendData();
     $securityManager = new CSecurityManager();
     $securityManager->cryptAlgorithm = array('rijndael-256', '', 'cbc', '');
     $securityManager->encryptionKey = $this->id . Yii::app()->params['outbound_api_secret'];
     return base64_encode($securityManager->encrypt(json_encode($orderdict)));
 }