fix unit test execution, variable naming and kill no longer used $cacheFactory
This commit is contained in:
parent
c266b3b5b7
commit
48fc3f3afe
|
@ -111,20 +111,21 @@ class KeyManager {
|
||||||
'recoveryKeyId');
|
'recoveryKeyId');
|
||||||
$this->publicShareKeyId = $this->config->getAppValue('encryption',
|
$this->publicShareKeyId = $this->config->getAppValue('encryption',
|
||||||
'publicShareKeyId');
|
'publicShareKeyId');
|
||||||
|
$this->log = $log;
|
||||||
|
|
||||||
if (empty($this->publicShareKeyId)) {
|
if (empty($this->publicShareKeyId)) {
|
||||||
$this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
|
$this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
|
||||||
$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
|
$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
|
||||||
|
|
||||||
$keypair = $this->crypt->createKeyPair();
|
$keyPair = $this->crypt->createKeyPair();
|
||||||
|
|
||||||
// Save public key
|
// Save public key
|
||||||
$this->keyStorage->setSystemUserKey(
|
$this->keyStorage->setSystemUserKey(
|
||||||
$this->publicShareKeyId . '.publicKey',
|
$this->publicShareKeyId . '.publicKey',
|
||||||
$keypair['publicKey']);
|
$keyPair['publicKey']);
|
||||||
|
|
||||||
// Encrypt private key empty passphrase
|
// Encrypt private key empty passphrase
|
||||||
$encryptedKey = $this->crypt->symmetricEncryptFileContent($keypair['privateKey'], '');
|
$encryptedKey = $this->crypt->symmetricEncryptFileContent($keyPair['privateKey'], '');
|
||||||
if ($encryptedKey) {
|
if ($encryptedKey) {
|
||||||
$this->keyStorage->setSystemUserKey($this->publicShareKeyId . '.privateKey', $encryptedKey);
|
$this->keyStorage->setSystemUserKey($this->publicShareKeyId . '.privateKey', $encryptedKey);
|
||||||
} else {
|
} else {
|
||||||
|
@ -337,7 +338,7 @@ class KeyManager {
|
||||||
public function setPassphrase($params, IUserSession $user, Util $util) {
|
public function setPassphrase($params, IUserSession $user, Util $util) {
|
||||||
|
|
||||||
// Get existing decrypted private key
|
// Get existing decrypted private key
|
||||||
$privateKey = self::$cacheFactory->get('privateKey');
|
$privateKey = self::$session->get('privateKey');
|
||||||
|
|
||||||
if ($params['uid'] === $user->getUser()->getUID() && $privateKey) {
|
if ($params['uid'] === $user->getUser()->getUID() && $privateKey) {
|
||||||
|
|
||||||
|
@ -372,17 +373,17 @@ class KeyManager {
|
||||||
|
|
||||||
$newUserPassword = $params['password'];
|
$newUserPassword = $params['password'];
|
||||||
|
|
||||||
$keypair = $this->crypt->createKeyPair();
|
$keyPair = $this->crypt->createKeyPair();
|
||||||
|
|
||||||
// Disable encryption proxy to prevent recursive calls
|
// Disable encryption proxy to prevent recursive calls
|
||||||
$proxyStatus = \OC_FileProxy::$enabled;
|
$proxyStatus = \OC_FileProxy::$enabled;
|
||||||
\OC_FileProxy::$enabled = false;
|
\OC_FileProxy::$enabled = false;
|
||||||
|
|
||||||
// Save public key
|
// Save public key
|
||||||
$this->setPublicKey($user, $keypair['publicKey']);
|
$this->setPublicKey($user, $keyPair['publicKey']);
|
||||||
|
|
||||||
// Encrypt private key with new password
|
// Encrypt private key with new password
|
||||||
$encryptedKey = $this->crypt->symmetricEncryptFileContent($keypair['privateKey'],
|
$encryptedKey = $this->crypt->symmetricEncryptFileContent($keyPair['privateKey'],
|
||||||
$newUserPassword);
|
$newUserPassword);
|
||||||
|
|
||||||
if ($encryptedKey) {
|
if ($encryptedKey) {
|
||||||
|
|
Loading…
Reference in New Issue