key creation should never override a private or public key
This commit is contained in:
parent
171b9a4702
commit
8e0540d0e4
1 changed files with 11 additions and 1 deletions
|
@ -212,9 +212,10 @@ class Util
|
|||
}
|
||||
|
||||
// Create user keypair
|
||||
// we should never override a keyfile
|
||||
if (
|
||||
!$this->view->file_exists($this->publicKeyPath)
|
||||
or !$this->view->file_exists($this->privateKeyPath)
|
||||
&& !$this->view->file_exists($this->privateKeyPath)
|
||||
) {
|
||||
|
||||
// Generate keypair
|
||||
|
@ -233,6 +234,15 @@ class Util
|
|||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
|
||||
} else {
|
||||
// check if public-key exists but private-key is missing
|
||||
if($this->view->file_exists($this->publicKeyPath) && !$this->view->file_exists($this->privateKeyPath)) {
|
||||
\OC_Log::write('Encryption library', 'public key exists but private key is missing for "' . $this->userId . '"', \OC_Log::FATAL);
|
||||
return false;
|
||||
} else if(!$this->view->file_exists($this->publicKeyPath) && $this->view->file_exists($this->privateKeyPath)) {
|
||||
\OC_Log::write('Encryption library', 'private key exists but public key is missing for "' . $this->userId . '"', \OC_Log::FATAL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no record for this user's encryption preferences
|
||||
|
|
Loading…
Reference in a new issue