Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()


D:\wamp64\cyage\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php


  1. *@paramstring $cipher
  2. *@returnstring
  3. */
  4. public static function generateKey($cipher)
  5. {
  6. return random_bytes($cipher == 'AES-128-CBC' ? 16 : 32);
  7. }
  8. /**
  9. *Encrypt the given value.
  10. *
  11. *@param mixed $value
  12. *@parambool $serialize
  13. *@returnstring
  14. *
  15. *@throws \Illuminate\Contracts\Encryption\EncryptException
  16. */
  17. public function encrypt($value, $serialize = true)
  18. {
  19. $iv = random_bytes(openssl_cipher_iv_length($this->cipher));
  20. //First we will encrypt the value usingOpenSSL.Afterthisis encrypted we
  21. // will proceed to calculating a MAC for the encrypted value so that this
  22. // value can be verified later as not having been changed by the users.
  23. $value = \openssl_encrypt(
  24. $serialize ? serialize($value): $value,
  25. $this->cipher, $this->key,0, $iv
  26. );
  27. if($value ===false){
  28. thrownewEncryptException('Could not encrypt the data.');
  29. }
  30. // Once we get the encrypted value we'll go ahead and base64_encode the input
  31. // vector and create the MAC for the encrypted value so we can then verify
  32. // its authenticity. Then, we'll JSON the data into the "payload" array.
  33. $mac = $this->hash($iv = base64_encode($iv), $value);
  34. $json = json_encode(compact('iv','value','mac'));
Arguments
  1. "Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()"
    


點贊 取消點贊 收藏 取消收藏

<< 上一篇: 新手求助,为什么我用 Request 请求类,对数据进行验证,无论对错然后他主动跳到欢迎页面?

>> 下一篇: 有没有办法在自己的代码中, 使用 'XXXController@YYY' 这种写法调用控制器的方法?