fix: bin2hex() calls
This commit is contained in:
parent
37a243b42f
commit
a5a86cc1cd
|
@ -137,6 +137,7 @@ App::post('/v1/storage/files')
|
|||
$data = $compressor->compress($data);
|
||||
$key = App::getEnv('_APP_OPENSSL_KEY_V1');
|
||||
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
|
||||
$tag = null;
|
||||
$data = OpenSSL::encrypt($data, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag);
|
||||
|
||||
if (!$device->write($path, $data, $mimeType)) {
|
||||
|
@ -162,7 +163,7 @@ App::post('/v1/storage/files')
|
|||
'comment' => '',
|
||||
'openSSLVersion' => '1',
|
||||
'openSSLCipher' => OpenSSL::CIPHER_AES_128_GCM,
|
||||
'openSSLTag' => \bin2hex($tag),
|
||||
'openSSLTag' => \bin2hex($tag ?? ''),
|
||||
'openSSLIV' => \bin2hex($iv),
|
||||
'search' => implode(' ', [$fileId, $file['name'] ?? '',]),
|
||||
]));
|
||||
|
|
|
@ -286,8 +286,8 @@ Database::addFilter('encrypt',
|
|||
return json_encode([
|
||||
'data' => OpenSSL::encrypt($value, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag),
|
||||
'method' => OpenSSL::CIPHER_AES_128_GCM,
|
||||
'iv' => bin2hex($iv),
|
||||
'tag' => bin2hex($tag),
|
||||
'iv' => \bin2hex($iv),
|
||||
'tag' => \bin2hex($tag ?? ''),
|
||||
'version' => '1',
|
||||
]);
|
||||
},
|
||||
|
|
|
@ -46,8 +46,8 @@ class V06 extends Migration
|
|||
$document->setAttribute('secret', json_encode([
|
||||
'data' => OpenSSL::encrypt($document->getAttribute('secret'), OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag),
|
||||
'method' => OpenSSL::CIPHER_AES_128_GCM,
|
||||
'iv' => bin2hex($iv),
|
||||
'tag' => bin2hex($tag),
|
||||
'iv' => \bin2hex($iv),
|
||||
'tag' => \bin2hex($tag ?? ''),
|
||||
'version' => '1',
|
||||
]));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue