我需要在2个laravel和不同的app键之间传递加密的信息。但是在第二个laravel上,我无法读取数据。
我尝试过的(不正常,正常):
Crypt::encrypt($request['infos'])
另一项测试:
$crypt=new \Illuminate\Encryption\Encrypter('base64:mnBCwiIMaW5QqwEixWp79bunoYt0MGHTIhdOpkDd9Oc=', 'AES-256-CBC')
$crypt=$crypt->encrypt($request['infos'])
和
$crypt=new \Illuminate\Encryption\Encrypter('mnBCwiIMaW5QqwEixWp79bunoYt0MGHTIhdOpkDd9Oc=', 'AES-256-CBC')
$crypt=$crypt->encrypt($request['infos'])
错误:The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths
。
我尝试在$this->key
__construct
方法上覆盖Illuminate\Encryption\Encrypter
属性
还是最后一次,我试图覆盖$key
register
方法的Illuminate\Encryption\EncryptionServiceProvider
在我的第二个laravel上,我犯了同样的错误:The MAC is invalid
答案 0 :(得分:0)
显然,这是Windows环境的一个问题:https://github.com/vlucas/phpdotenv/issues/219 我在MAMP上尝试了相同的代码并且它正在工作