bugfixes
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Родитель
c2cc9c73b1
Коммит
8ec303bf2c
|
@ -8,3 +8,4 @@ node_modules/
|
|||
js/*hot-update.*
|
||||
.php_cs.cache
|
||||
\.vscode/
|
||||
js/backup-*
|
||||
|
|
|
@ -2859,7 +2859,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"abandoned": true,
|
||||
"time": "2020-09-28T06:45:17+00:00"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ Backup.prototype = {
|
|||
scanBackupFile: function(fileName, context) {
|
||||
var fileId = context.$file.data('id')
|
||||
$.ajax({
|
||||
method: 'PUT',
|
||||
method: 'POST',
|
||||
url: OC.linkToOCS('apps/backup/action/scan', 2) + fileId + '?format=json'
|
||||
}).done(function(res) {
|
||||
OCP.Toast.success(res.ocs.data.message);
|
||||
|
|
|
@ -191,7 +191,7 @@ class PointDetails extends Base {
|
|||
}
|
||||
|
||||
$table = new Table($output);
|
||||
$table->setHeaders(['Chunk Id', 'Size', 'Count', 'Part Id', 'Checksum', 'verified']);
|
||||
$table->setHeaders(['Chunk Id', 'Size', 'Count', 'Part Id', 'Checksum', 'Algorithm', 'verified']);
|
||||
$table->render();
|
||||
|
||||
foreach ($data->getChunks() as $chunk) {
|
||||
|
@ -278,6 +278,7 @@ class PointDetails extends Base {
|
|||
($fresh) ? $chunk->getCount() : '',
|
||||
$part->getName(),
|
||||
$part->getCurrentChecksum(),
|
||||
$part->getAlgorithm(),
|
||||
$status
|
||||
]
|
||||
);
|
||||
|
|
|
@ -130,6 +130,10 @@ class SetupImport extends Base {
|
|||
}
|
||||
|
||||
$this->configService->setAppValue('key_pairs', $this->get('signatory', $setup));
|
||||
$this->configService->setAppValue(
|
||||
ConfigService::ENCRYPTION_KEYS,
|
||||
json_encode($this->getArray('encryption', $setup))
|
||||
);
|
||||
|
||||
/** @var RemoteInstance[] $remotes */
|
||||
$remotes = $this->deserializeArray($this->getArray('remote', $setup), RemoteInstance::class);
|
||||
|
|
|
@ -69,8 +69,7 @@ class Backup extends TimedJob {
|
|||
CronService $cronService,
|
||||
ConfigService $configService
|
||||
) {
|
||||
// $this->setInterval(900);
|
||||
$this->setInterval(1);
|
||||
$this->setInterval(900);
|
||||
|
||||
$this->pointService = $pointService;
|
||||
$this->cronService = $cronService;
|
||||
|
|
|
@ -86,8 +86,7 @@ class Manage extends TimedJob {
|
|||
ExternalFolderService $externalFolderService,
|
||||
ConfigService $configService
|
||||
) {
|
||||
$this->setInterval(1);
|
||||
// $this->setInterval(3600 * 3); // 3 hours ?
|
||||
$this->setInterval(3600);
|
||||
|
||||
$this->cronService = $cronService;
|
||||
$this->pointService = $pointService;
|
||||
|
|
|
@ -86,13 +86,13 @@ class EncryptService {
|
|||
|
||||
/**
|
||||
* @param string $plain
|
||||
* @param string $key
|
||||
* @param string $generatedKey
|
||||
*
|
||||
* @return string
|
||||
* @throws EncryptionKeyException
|
||||
* @throws PackEncryptException
|
||||
*/
|
||||
public function encryptString(string $plain, string &$key = ''): string {
|
||||
public function encryptString(string $plain, string &$generatedKey = ''): string {
|
||||
$key = $this->getEncryptionKey(self::STRING, false);
|
||||
$nonce = $this->getEncryptionKey(self::STRING_NONCE, false);
|
||||
$encrypted = openssl_encrypt(
|
||||
|
@ -107,7 +107,7 @@ class EncryptService {
|
|||
throw new PackEncryptException('data were not encrypted');
|
||||
}
|
||||
|
||||
$key = base64_encode($key) . '.' . base64_encode($nonce);
|
||||
$generatedKey = base64_encode($key) . '.' . base64_encode($nonce);
|
||||
|
||||
return base64_encode($encrypted);
|
||||
}
|
||||
|
@ -427,47 +427,17 @@ class EncryptService {
|
|||
* @throws Exception
|
||||
*/
|
||||
private function generateKey(string $type): string {
|
||||
if (!$this->isSodiumAvailable()) {
|
||||
return $this->generateKeyNative($type);
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case self::CHACHA:
|
||||
return base64_encode(random_bytes(SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES));
|
||||
case self::AES_GCM:
|
||||
case self::AES_CBC:
|
||||
return base64_encode(random_bytes(SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES));
|
||||
case self::AES_CBC_IV:
|
||||
case self::AES_GCM_NONCE:
|
||||
return base64_encode(random_bytes(SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES));
|
||||
case self::STRING:
|
||||
return base64_encode(random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES));
|
||||
case self::STRING_NONCE:
|
||||
return base64_encode(random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES));
|
||||
}
|
||||
|
||||
throw new EncryptionKeyException('unknown key type');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
*
|
||||
* @return string
|
||||
* @throws EncryptionKeyException
|
||||
*/
|
||||
private function generateKeyNative(string $type): string {
|
||||
switch ($type) {
|
||||
case self::CHACHA:
|
||||
case self::AES_GCM:
|
||||
case self::AES_CBC:
|
||||
case self::STRING:
|
||||
return base64_encode(random_bytes(32));
|
||||
case self::AES_CBC_IV:
|
||||
case self::AES_GCM_NONCE:
|
||||
return base64_encode(random_bytes(12));
|
||||
case self::AES_CBC_IV:
|
||||
case self::STRING_NONCE:
|
||||
return base64_encode(random_bytes(24));
|
||||
return base64_encode(random_bytes(12));
|
||||
}
|
||||
|
||||
throw new EncryptionKeyException('unknown key type');
|
||||
|
|
Загрузка…
Ссылка в новой задаче