diff options
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r-- | apps/encryption/lib/keymanager.php | 8 | ||||
-rw-r--r-- | apps/encryption/lib/users/setup.php | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/keymanager.php index 1e6f3d29be8..bde8212e9dc 100644 --- a/apps/encryption/lib/keymanager.php +++ b/apps/encryption/lib/keymanager.php @@ -131,6 +131,11 @@ class KeyManager { $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); } + $this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false; + $this->log = $log; + } + + public function validateShareKey() { $shareKey = $this->getPublicShareKey(); if (empty($shareKey)) { $keyPair = $this->crypt->createKeyPair(); @@ -145,9 +150,6 @@ class KeyManager { $header = $this->crypt->generateHeader(); $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); } - - $this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false; - $this->log = $log; } /** diff --git a/apps/encryption/lib/users/setup.php b/apps/encryption/lib/users/setup.php index 2ec49b5c7fb..fd8261cc637 100644 --- a/apps/encryption/lib/users/setup.php +++ b/apps/encryption/lib/users/setup.php @@ -79,6 +79,7 @@ class Setup { * @return bool */ public function setupServerSide($uid, $password) { + $this->keyManager->validateShareKey(); // Check if user already has keys if (!$this->keyManager->userHasKeys($uid)) { return $this->keyManager->storeKeyPair($uid, $password, |