after the master key was loaded we are ready to go, no re-login needed
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
da51ec38f4
commit
28a7e72868
|
@ -31,4 +31,5 @@ $app = new Application([], $encryptionSystemReady);
|
|||
if ($encryptionSystemReady) {
|
||||
$app->registerEncryptionModule();
|
||||
$app->registerHooks();
|
||||
$app->setUp();
|
||||
}
|
||||
|
|
|
@ -67,7 +67,11 @@ class Application extends \OCP\AppFramework\App {
|
|||
$session = $this->getContainer()->query('Session');
|
||||
$session->setStatus(Session::RUN_MIGRATION);
|
||||
}
|
||||
if ($this->encryptionManager->isEnabled() && $encryptionSystemReady) {
|
||||
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
if ($this->encryptionManager->isEnabled()) {
|
||||
/** @var Setup $setup */
|
||||
$setup = $this->getContainer()->query('UserSetup');
|
||||
$setup->setupSystem();
|
||||
|
@ -77,7 +81,6 @@ class Application extends \OCP\AppFramework\App {
|
|||
/**
|
||||
* register hooks
|
||||
*/
|
||||
|
||||
public function registerHooks() {
|
||||
if (!$this->config->getSystemValue('maintenance', false)) {
|
||||
|
||||
|
|
|
@ -179,8 +179,8 @@ class KeyManager {
|
|||
return;
|
||||
}
|
||||
|
||||
$masterKey = $this->getPublicMasterKey();
|
||||
if (empty($masterKey)) {
|
||||
$publicMasterKey = $this->getPublicMasterKey();
|
||||
if (empty($publicMasterKey)) {
|
||||
$keyPair = $this->crypt->createKeyPair();
|
||||
|
||||
// Save public key
|
||||
|
@ -193,6 +193,15 @@ class KeyManager {
|
|||
$header = $this->crypt->generateHeader();
|
||||
$this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey);
|
||||
}
|
||||
|
||||
if (!$this->session->isPrivateKeySet()) {
|
||||
$masterKey = $this->getSystemPrivateKey($this->masterKeyId);
|
||||
$decryptedMasterKey = $this->crypt->decryptPrivateKey($masterKey, $this->getMasterKeyPassword(), $this->masterKeyId);
|
||||
$this->session->setPrivateKey($decryptedMasterKey);
|
||||
}
|
||||
|
||||
// after the encryption key is available we are ready to go
|
||||
$this->session->setStatus(Session::INIT_SUCCESSFUL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue