Commit Graph

303 Commits (646dfd2a40aa79b8fed8be314070bb8f629a6edc)

Author SHA1 Message Date
Côme Chilliet 2a6f347430 Increase from 100000 to 600000 iterations for hash_pbkdf2
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-23 20:53:33 +07:00
Côme Chilliet 49108880d2
Add fclose on opened resources
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 17:53:19 +07:00
Côme Chilliet a92028f5cd
Rename command to drop-legacy-filekey and remove comment about legacy mode.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 11:56:14 +07:00
Côme Chilliet 36fc5dc8ae
Copy data back instead of renaming to avoid changing the fileid
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 11:24:16 +07:00
Côme Chilliet 725403cb0d
Copy and move files to migrate them to the new key
We have to rewrite the header, so the whole file needs to be rewritten,
 so we just use the same strategy as DecryptAll.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-09 12:02:57 +07:00
Côme Chilliet c9c49bfef8
Log failures to delete legacy file key
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-04 17:50:51 +07:00
Côme Chilliet 146284f170
Fix fopen mode
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-04 17:50:34 +07:00
Côme Chilliet 5663f9b31e
Add an occ command to scan files for legacy file key in use and get rid of those
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-04 16:53:25 +07:00
Christoph Wurst b952066140
Merge pull request #37724 from nextcloud/fix/encryption-signature-check-logic
Cleanup signature checking logic in encryption
2023-04-17 17:39:34 +07:00
Joas Schilling 0b88b513be
Merge pull request #36351 from nextcloud/bugfix/noid/move-encryption-password-email-to-template
Move encrypt-all password email to EmailTemplate
2023-04-14 14:48:47 +07:00
jld3103 2f653c8be8
Cleanup signature checking logic in encryption
Signed-off-by: jld3103 <jld3103yt@gmail.com>
2023-04-14 09:07:20 +07:00
Côme Chilliet 430009b8e2
Add a test for multiKeyEncrypt/Decrypt methods
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-20 14:19:13 +07:00
Côme Chilliet 24e762c59f
Fix encryption file key management
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-17 11:08:59 +07:00
Côme Chilliet 8900d030d1
Adapt code to new encryption system
fileKey gets deleted upon save as it’s stored in shareKeys instead now.
We use presence of a fileKey to detect if a file is using the legacy
 system or the new one, because we do not always have access to header
 data.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-17 11:08:58 +07:00
Côme Chilliet fbe282caeb
Getting rid of openssl_seal and rc4 in server side encryption
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-17 11:08:50 +07:00
Joas Schilling 0f7146c652
Move encrypt-all password email to EmailTemplate
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-03-08 12:15:18 +07:00
Côme Chilliet f2912ce8bc Set functions as private to be able to refactor later
Also a few comment fixes

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-21 13:36:25 +07:00
Côme Chilliet 71482576ad Move to phpseclib implementation of RC4
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-21 13:36:25 +07:00
Côme Chilliet bd626e3693 Strong type custom openssl_seal implementation
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-21 13:36:25 +07:00
Côme Chilliet deed6393fb Always wrap rc4, and throws on unknown cipher
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-21 13:36:25 +07:00
Kevin Niehage 81638436e5 introduce wrapped_openssl_seal() and wrapped_openssl_open() to circument RC4 problems with OpenSSL v3
Signed-off-by: Kevin Niehage <k.niehage@syseleven.de>
2023-02-21 13:36:25 +07:00
Côme Chilliet 7ebbb6b2ca
Remove workarounds specific to 7.4
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:22:08 +07:00
Côme Chilliet 9430899f16
Fix psalm issues related to signature changes from PHP 8.0
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-29 12:36:34 +07:00
Vincent Petry 3bcbc4701a
Merge pull request #34724 from nextcloud/encryption-read-before-cache
fix reading newly written encrypted files before their cache entry is written
2022-12-20 17:16:12 +07:00
Vincent Petry 4f2923862a
Merge pull request #35108 from nextcloud/encryption-fix-versions-all
allow running encryption:fix-encrypted-version for all users
2022-12-16 17:20:40 +07:00
J0WI 71e490090f Replace getSystemValue in encryption app
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2022-12-05 14:30:58 +07:00
Robin Appelman e3a0e64698
clear is-encrypted cache when trying to fix encrypted version
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-12-01 14:36:27 +07:00
Robin Appelman 2399710356
allow running encryption:fix-encrypted-version for all users
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-29 17:49:35 +07:00
Robin Appelman dd4ebbd72a
add migration for encryption keys in wrong location
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-28 16:12:11 +07:00
Robin Appelman 06b2ed2641
skip files that cant be opened for FixEncryptedVersion
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-22 16:40:12 +07:00
luz paz 9d26671f05 Fix typos in apps/ subdirectory
Found via `codespell -q 3 -S l10n,./apps/files_external/3rdparty -L adn,ba,boxs,keypair,jus,optionel,ressource,tabel ./apps/`

Signed-off-by: luz paz <luzpaz@github.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2022-09-05 12:59:54 +07:00
Côme Chilliet b20278f708
Fix encryption:fix-encrypted-version command when encrypted is set to 0
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-02 12:47:26 +07:00
Côme Chilliet bd467e5d66
Improve typing in FixEncryptedVersion command
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-02 12:11:15 +07:00
plumbeo 1258caeab7 Save encrypted files in binary format
Default to the more space-efficient binary encoding for newly encrypted files
instead of the traditional base64 encoding, eliminating the 33% overhead.

The new option 'encryption.use_legacy_encoding' allows to force the legacy
encoding format if needed. Files encoded in the old format remain readable.

Based on https://github.com/owncloud/encryption/pull/224 and
https://github.com/owncloud/core/pull/38249 by karakayasemi.

Signed-off-by: plumbeo <plumbeo@users.noreply.github.com>
2022-05-04 17:38:25 +07:00
Carl Schwan aeecb72e96
Fix a few psalm issues and moved back to psalm/phar 4.18
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-12 20:03:06 +07:00
Côme Chilliet 37f8f7a5a1
Fix tests on PHP 8.1 for encryption, files_sharing, files_version,
files_trashbin and theming apps

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:43:29 +07:00
Vincent Petry 60e44077b7
Fix encrypted version to 0 when finding unencrypted file
Whenever the command is run and a "legacy cipher" seems to be detected
when the legacy option is disabled, it's highly likely that the file is
actually unencrypted but the database contains a encrypted version
higher than 0 for some reason.

The command now detects this case and automatically sets the encrypted
version to 0 so that the file can be read again.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-08-26 10:44:49 +07:00
J0WI 91051d9207 Generate strong, human readable OTP
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2021-07-08 15:11:33 +07:00
Gary Kim b78f3a57d1
Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
2021-06-30 15:28:02 +07:00
Julius Härtl 75f7287b5e
Merge pull request #27638 from nextcloud/enh/noid/fix-encrypted-version 2021-06-30 14:17:38 +07:00
Vincent Petry d3eeecba54
Prevent running FixEncryptedVersion without master key
Return an error when running occ encryption:fix-encrypted-version
when master key encryption is not enabled.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 20:44:07 +07:00
Vincent Petry 101c65a949
Fix FixEncryptedVersionTest test
Fixed setup to use EncryptionTrait like other existing tests.
Fix expectations to not rely on side effects from previous test cases.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +07:00
Vincent Petry 6170912ace
Fix warnings in FixEncryptedVersion command
Fixed code warnings

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +07:00
Vincent Petry 4e9241c706
Detect disabled signature check when reparing
When running occ encryption:fix-encrypted-version, detect whether the
setting 'encryption_skip_signature_check' is set and abort if it is,
because the repair cannot detect version mismatch errors with it
enabled.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +07:00
Vincent Petry a6dc81d419
Downstream encryption:fix-encrypted-version
For fixing "Bad signature" errors.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +07:00
J0WI c694b9d52b Remember current cipher
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2021-06-29 13:41:22 +07:00
blizzz c6d5653a85
Merge pull request #26323 from J0WI/crypt-const
Use constant for supported formats
2021-06-23 11:17:05 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Valdnet b9d00a96b3
l10n: Unify spelling
Spelling unification in Nextcloud applications.
2021-05-20 09:22:07 +07:00
Roeland Jago Douma 7c30d1aa2d
Merge pull request #26219 from nextcloud/relative-path-null
getRelativePath can return null
2021-03-30 21:10:05 +07:00