Browse Source

move creation of shared key to the login handler - fixes #15705

tags/v8.1.0beta1
Thomas Müller 9 years ago
parent
commit
c6e243928c
2 changed files with 6 additions and 3 deletions
  1. 5
    3
      apps/encryption/lib/keymanager.php
  2. 1
    0
      apps/encryption/lib/users/setup.php

+ 5
- 3
apps/encryption/lib/keymanager.php View File

@@ -130,6 +130,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();
@@ -143,9 +148,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;
}

/**

+ 1
- 0
apps/encryption/lib/users/setup.php View File

@@ -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,

Loading…
Cancel
Save