3 pages

Encryption - Laravel

of 3
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
  2017-5-16 Encryption - Laravel - The PHP Framework For Web Artisans 1/3 ☰ Encryption ConfigurationBasic Usage Before using Laravel's encrypter, you should set the key  option of your config/app.php  configuration file to a 32character, random string. If this value is not properly set, all values encrypted by Laravel will be insecure. Encrypting A Value  You may encrypt a value using the Crypt  facade. All encrypted values are encrypted using OpenSSL and the AES‐256‐CBC  cipher. Furthermore, all encrypted values are signed with a message authentication code (MAC) todetect any modifications to the encrypted string.For example, we may use the encrypt  method to encrypt a secret and store it on an Eloquent model: <?php namespace App\Http\Controllers;  use Crypt;  use App\User;  use Illuminate\Http\Request;  use App\Http\Controllers\Controller;  class UserController extends Controller { **   SEARCH 5.2 ConfigurationBasic Usage  2017-5-16 Encryption - Laravel - The PHP Framework For Web Artisans 2/3  * Store a secret message for the user. * * @param Request $request * @param int $id * @return Response */ public function storeSecret(Request $request, $id)  { $user = User::findOrFail($id);  $user‐>fill([  'secret' => Crypt::encrypt($request‐>secret)  ])‐>save();  } } Note:  Encrypted values are passed through serialize  during encryption, which allows for encryption of objects and arrays. Thus, non-PHP clients receiving encrypted values will need to unserialize  the data. Decrypting A Value Of course, you may decrypt values using the decrypt  method on the Crypt  facade. If the value can not beproperly decrypted, such as when the MAC is invalid, an Illuminate\Contracts\Encryption\DecryptException  willbe thrown: use Illuminate\Contracts\Encryption\DecryptException;  try {  $decrypted = Crypt::decrypt($encryptedValue);  } catch (DecryptException $e) {  // } LARAVEL IS A TRADEMARK OF TAYLOR OTWELL. COPYRIGHT © TAYLOR OTWELL. DESIGNED BY  2017-5-16 Encryption - Laravel - The PHP Framework For Web Artisans 3/3
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!