up. 双向数据加密
This commit is contained in:
parent
593381f119
commit
701610d683
@ -24,6 +24,9 @@ class ContextMiddleware extends middleware
|
||||
$encryptedData = $request->param('encryptedData','');
|
||||
if($encryptedData) {
|
||||
$jsonInput = $this->decryptCryptoJSData($encryptedData);
|
||||
if($jsonInput) {
|
||||
return json(['code'=>500,'message'=>'E0.数据解密失败']);
|
||||
}
|
||||
$request->withInput($jsonInput);
|
||||
}
|
||||
}
|
||||
@ -181,14 +184,13 @@ class ContextMiddleware extends middleware
|
||||
$iv = $keyIv['iv'];
|
||||
|
||||
// AES-256-CBC解密
|
||||
$decrypted = openssl_decrypt(
|
||||
return openssl_decrypt(
|
||||
$ct,
|
||||
'aes-256-cbc',
|
||||
$key,
|
||||
OPENSSL_RAW_DATA,
|
||||
$iv
|
||||
);
|
||||
return $decrypted;
|
||||
}
|
||||
|
||||
private function evpBytesToKey($salt): array
|
||||
|
||||
Loading…
Reference in New Issue
Block a user