我似乎找不到有关此问题的有效答案...
我正在使用内置的 crypt :: gencrypt()
helper函数并传递简单字符串值(假设'abcde'
出于本示例的目的)
如果我能提供帮助,我不想在Laravel中安装任何第三方库。我也有我的laravel app_key
,它是一个以 base64:
开始的字符串值,但我不确定它的何处。
这为我生成了一个加密的字符串,我将其传递给VB.NET应用程序。
我无法锻炼如何简单地解码我的应用程序中的加密字符串,以删除'abcde''
的原始密码。
我尝试了许多可以在线找到的示例,但是我一直遇到有关“不是有效键”或“不是有效的base64字符串”等的错误
。在.net?
我能做到的最好的是将加密的字符串分解为 iv
, value
和 mac
,但我似乎无法进一步。
任何帮助将不胜感激。
I can't seem to find a valid answer to this issue...
I am encrypting a password in Laravel using the built in Crypt::encrypt()
helper function and passing in a simple string value (let's say 'abcde'
for the purpose of this example)
I don't want to install any 3rd party libraries in Laravel if I can help it. I also have my Laravel APP_KEY
which is a string value starting with Base64:
, but I'm not sure where this comes into it.
This generates me an encrypted string to which I pass down to a VB.Net application.
I cannot workout how to simply decode the encrypted string in my application to pluck out the raw password of 'abcde'
.
I have tried many examples that I can find online, but I keep getting errors about "Not a valid key" or "Not a valid Base64 string", etc.
Does someone have an example of a code snippet that will decode a Laravel encrypted string in .Net?
The best I can get to is breaking the encrypted string down into iv
, value
and mac
, but I can't seem to get any further.
Any help would be appreciated.
发布评论
评论(1)
开始开始,让我们看“内部”
crypt
filevendor/laravel/framework/src/src/inluminate/concryption/encrypter.php
param> param
键/code> in
__构造
方法是base64解码值(在调用中更深的地方)app_key的.env .env
之后的文件:
cipher < /code>在
AES-256-CBC
rel =“ nofollow noreferrer”> docs (需要提及,该部分在所有现有版本的Laravel(包括V9)(当时)中保持不变,请接下来寻找加密以
在此处 获取操作订单我们有基本64编码的JSON数组,它具有base64编码
iv
和未手动编码value
c#part(解析JSON newtonsoft json ,.net472)
来自 Microsoft docs (此部分保持'as'是',因为
要绑所有这些东西,
需要说我并没有很努力地挖掘加密算法,甚至没有尝试此代码可以处理使用
$ mac
param的algos,因此,如果某人想要要添加更多信息 - 欢迎您to begin let's look 'inside'
Crypt
facade in filevendor/laravel/framework/src/Illuminate /Encryption/Encrypter.php
param
key
in__construct
method is base64 decoded value (somewhere deeper in calls) of APP_KEY from.env
file after:
cipher
also somewhere deeper is set toAES-256-CBC
as mentioned in the docs (need to mention that this part stays the same across all existing versions of laravel including v9 at the moment)next looking for encryption to get actions order
here we have base64 encoded json array with base64 encoded
iv
and not encoded manuallyvalue
c# part (to parse json newtonsoft json, .net472)
from microsoft docs (this part stays 'as is' because php uses same pkcs7 padding by default)
and our working
parse
method to tie all this stuffneed to say that i didn't dig very hard into varians of encryption algos and didn't even try this code can deal with algos that uses
$mac
param, so if someone wants to add more info - you are welcome