From 7092c50e7c514e795c07be734f105fcbc6f9d21d Mon Sep 17 00:00:00 2001 From: Kenneth Newwood Date: Mon, 11 Sep 2017 12:52:25 +0200 Subject: print generated encryption key passwords directly after generating the keys so that errors during the encryption do not lead to a potentially massive data loss Signed-off-by: Kenneth Newwood --- apps/encryption/lib/Crypto/EncryptAll.php | 15 +++++++++------ apps/encryption/tests/Crypto/EncryptAllTest.php | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'apps') diff --git a/apps/encryption/lib/Crypto/EncryptAll.php b/apps/encryption/lib/Crypto/EncryptAll.php index 60c7b13b708..2afab22d522 100644 --- a/apps/encryption/lib/Crypto/EncryptAll.php +++ b/apps/encryption/lib/Crypto/EncryptAll.php @@ -153,12 +153,8 @@ class EncryptAll { $this->createKeyPairs(); } - //setup users file system and encrypt all files one by one (take should encrypt setting of storage into account) - $this->output->writeln("\n"); - $this->output->writeln('Start to encrypt users files'); - $this->output->writeln('----------------------------'); - $this->output->writeln(''); - $this->encryptAllUsersFiles(); + + // output generated encryption key passwords if ($this->util->isMasterKeyEnabled() === false) { //send-out or display password list and write it to a file $this->output->writeln("\n"); @@ -167,6 +163,13 @@ class EncryptAll { $this->output->writeln(''); $this->outputPasswords(); } + + //setup users file system and encrypt all files one by one (take should encrypt setting of storage into account) + $this->output->writeln("\n"); + $this->output->writeln('Start to encrypt users files'); + $this->output->writeln('----------------------------'); + $this->output->writeln(''); + $this->encryptAllUsersFiles(); $this->output->writeln("\n"); } diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index 6c279a54f57..df8401c15b2 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -149,8 +149,8 @@ class EncryptAllTest extends TestCase { $this->util->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false); $encryptAll->expects($this->at(0))->method('createKeyPairs')->with(); - $encryptAll->expects($this->at(1))->method('encryptAllUsersFiles')->with(); - $encryptAll->expects($this->at(2))->method('outputPasswords')->with(); + $encryptAll->expects($this->at(1))->method('outputPasswords')->with(); + $encryptAll->expects($this->at(2))->method('encryptAllUsersFiles')->with(); $encryptAll->encryptAll($this->inputInterface, $this->outputInterface); -- cgit v1.2.3