Example #1
0
 /**
  *
  * @see \CryptoUtil\PBE\PBEScheme::encryptWithKey()
  * @return string
  */
 public function encryptWithKey($data, $key)
 {
     if (strlen($key) !== 16) {
         throw new \UnexpectedValueException("Invalid key length.");
     }
     $algo = $this->_cipher->withInitializationVector(substr($key, 8, 8));
     $str = $this->_addPadding($data, 8);
     return $this->_crypto->encrypt($str, substr($key, 0, 8), $algo);
 }
Example #2
0
 /**
  *
  * @see \CryptoUtil\PBE\PBEScheme::encryptWithKey()
  * @return string
  */
 public function encryptWithKey($data, $key)
 {
     $str = $this->_addPadding($data, $this->_cipher->blockSize());
     return $this->_crypto->encrypt($str, $key, $this->_cipher);
 }