コード例 #1
0
 public function onReceive(swoole_client $cli, $data)
 {
     Trace::debug("*********cli {$this->fd} receive  lenght:" . strlen($data) . ".");
     false !== $this->serv->connection_info($this->fd) && $this->serv->send($this->fd, $this->cryptor->encrypt($data));
     $this->lock = false;
     $this->send();
 }
コード例 #2
0
 public function testSelfEncryptedVersion2VectorIsVersion2()
 {
     $encryptor = new Encryptor();
     $encrypted = $encryptor->encrypt(self::SAMPLE_PLAINTEXT, self::SAMPLE_PASSWORD, 2);
     $actualVersion = ord(substr(base64_decode($encrypted), 0, 1));
     $this->assertEquals(2, $actualVersion);
 }
コード例 #3
0
 private static function insertUserIntoDB($username, $password, $email)
 {
     //TODO make this use DBConnection::executeSQLCommand
     $connection = DBConnection::getConnection();
     $encryptedPassword = Encryptor::encrypt($password);
     $statement = $connection->prepare('INSERT INTO Users (username, email, password) VALUES (:username, :email, :password)');
     $statement->bindParam(':username', $username);
     $statement->bindParam(':email', $email);
     $statement->bindParam(':password', $encryptedPassword);
     $successful = $statement->execute();
     return $successful;
 }
コード例 #4
0
ファイル: LuckHelper.php プロジェクト: tianyong90/lucksdk
 /**
  * 调用纳客接口.
  *
  * @param string $_method 接口方法名
  * @param array  $data    发送的数据
  */
 public function callnake($_method, array $data = array())
 {
     //实际请求地址
     $url = trim($this->interfaceUrl, '/ \\/') . '/Interface/GeneralInterfaceHandler.ashx';
     //请求方法名加入到参数中
     $data['do'] = $_method;
     //如果是商盟旗舰版,则参数中加入店铺ID
     if ($this->luckVersion === self::LUCK_VERSION_ULTIMATE) {
         $data['ShopID'] = $this->shopId;
     }
     //数据
     foreach ($data as $key => $value) {
         $data[$key] = $this->encryptor->encrypt($value);
     }
     //企业代码不加密
     $data['CompCode'] = $this->companyCode;
     $this->result = $this->http->post($url, $data);
     return $this->result;
 }
コード例 #5
0
 /**
  * @param mixed $key
  *
  * @dataProvider encryptWithEmptyKeyDataProvider
  */
 public function testEncryptWithEmptyKey($key)
 {
     $model = new Encryptor($this->_randomGenerator, $this->_cryptFactory, $key);
     $value = 'arbitrary_string';
     $this->assertEquals($value, $model->encrypt($value));
 }
コード例 #6
0
 private function _generateEncryptedStringWithUnsupportedSchemaNumber($fakeSchemaNumber)
 {
     $encryptor = new Encryptor();
     $plaintext = 'The price of ice is nice for mice';
     $encrypted = $encryptor->encrypt($plaintext, self::SAMPLE_PASSWORD);
     $encryptedBinary = base64_decode($encrypted);
     $encryptedBinary = chr($fakeSchemaNumber) . substr($encryptedBinary, 1, strlen($encryptedBinary - 1));
     return base64_encode($encryptedBinary);
 }
コード例 #7
0
ファイル: User.class.php プロジェクト: laiello/gtlolwebsite
 public function passwordMatches($password)
 {
     return $this->encryptedPassword === Encryptor::encrypt($password);
 }
コード例 #8
0
ファイル: StripeCustomers.php プロジェクト: ranvijayj/htmlasa
 protected function beforeSave () {
     $this->Customer_ID= Encryptor::encrypt($this->Customer_ID);
     return parent::beforeSave();
 }