Skip to content

Conversation

@sharidas
Copy link
Contributor

@sharidas sharidas commented Sep 21, 2017

This change helps users to decrypt user
specific keys.

Signed-off-by: Sujith H sharidasan@owncloud.com

Description

This change would help users to fix the user specific key encrypted files at oC.

Related Issue

#29081

Motivation and Context

Without this change the decryption was failing files encrypted with user specific keys. With this change both masterkey encrypted files and user key encrypted files can be decrypted successfully.

How Has This Been Tested?

  • Enable encryption.
  • Enable master key encryption
  • Decryptall command worked successfully to decrypt the files of all users ( basically tested with all users ).

  • Enable encryption
  • Enable user specific key encryption.
  • Decryptall command worked successfully to decrypt files fo all users.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@sharidas sharidas self-assigned this Sep 21, 2017
@sharidas sharidas requested a review from PVince81 September 21, 2017 13:51
$userNo = 1;
foreach ($userList as $uid) {
$userCount = "$uid ($userNo of $numberOfUsers)";
if (\OC::$server->getAppConfig()->getValue('encryption', 'userSpecificKey', '0') !== '0') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not also do the check on "useMasterKey" here for consistency ? please decide on one condition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for not adding "useMasterKey" here is because we already do a check here: https://github.com/owncloud/core/pull/29072/files#diff-6f510adb432497f4f6a446f791729c79R93.
If "userSpecificKey" is enabled, then idea here is that we get the user and we pass it to method prepareEncryptionModules. For "userSpecificKey" the decryption was failing because we relied on https://github.com/owncloud/core/blob/master/lib/private/Encryption/DecryptAll.php#L93

$this->output->writeln('prepare encryption modules...');
if ($this->prepareEncryptionModules($user) === false) {
return false;
if (\OC::$server->getAppConfig()->getValue('encryption', 'useMasterKey', '0') !== 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗️
Default value '0' (string) won't be the same as 0 (integer)
I'm not sure what is the expected return type, but please, make sure it matches

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvillafanez Yes you are right. I have updated the PR.

This change helps users to decrypt user
specific keys.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit 575b586 into master Oct 10, 2017
@PVince81 PVince81 deleted the decryptall-fix branch October 10, 2017 07:59
@PVince81
Copy link
Contributor

@sharidas backport to stable10 ?

@sharidas
Copy link
Contributor Author

Backport for stable10 -> #29189

@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants