【问题标题】:Pass crypted informations between 2 laravel在2个laravel之间传递加密信息
【发布时间】:2017-06-17 22:12:36
【问题描述】:

我需要使用不同的应用程序密钥在 2 个 laravel 之间传递加密信息。但是在第二个 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

我试图覆盖Illuminate\Encryption\Encrypter__construct 方法上的$this->key 属性

最后一个,我试图覆盖registerIlluminate\Encryption\EncryptionServiceProvider$key方法

在我的第二个 laravel 中,我遇到了同样的错误:The MAC is invalid

【问题讨论】:

  • 我尝试了使用和不使用“base64:”但检查我的答案它解释了为什么它不起作用

标签: php laravel encryption laravel-5.2


【解决方案1】:

显然这是windows环境的问题:https://github.com/vlucas/phpdotenv/issues/219 我在 MAMP 上尝试了相同的代码,它正在工作

【讨论】:

    猜你喜欢
    • 2022-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-25
    • 1970-01-01
    • 2014-06-02
    相关资源
    最近更新 更多