make sure that encrypted private keys always have a header
This commit is contained in:
parent
1a894bd0d8
commit
389a101de6
|
@ -140,7 +140,8 @@ class KeyManager {
|
|||
|
||||
// Encrypt private key empty passphrase
|
||||
$encryptedKey = $this->crypt->symmetricEncryptFileContent($keyPair['privateKey'], '');
|
||||
$this->keyStorage->setSystemUserKey($this->publicShareKeyId . '.privateKey', $encryptedKey);
|
||||
$header = $this->crypt->generateHeader();
|
||||
$this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey);
|
||||
}
|
||||
|
||||
$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
|
||||
|
|
|
@ -135,8 +135,9 @@ class Recovery {
|
|||
$recoveryKey = $this->keyManager->getSystemPrivateKey($this->keyManager->getRecoveryKeyId());
|
||||
$decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $oldPassword);
|
||||
$encryptedRecoveryKey = $this->crypt->symmetricEncryptFileContent($decryptedRecoveryKey, $newPassword);
|
||||
$header = $this->crypt->generateHeader();
|
||||
if ($encryptedRecoveryKey) {
|
||||
$this->keyManager->setSystemPrivateKey($this->keyManager->getRecoveryKeyId(), $encryptedRecoveryKey);
|
||||
$this->keyManager->setSystemPrivateKey($this->keyManager->getRecoveryKeyId(), $header . $encryptedRecoveryKey);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue