Пример #1
0
 /**
  * @param $recoveryKeyId
  * @param $password
  * @return bool
  */
 public function enableAdminRecovery($password)
 {
     $appConfig = $this->config;
     $keyManager = $this->keyManager;
     if (!$keyManager->recoveryKeyExists()) {
         $keyPair = $this->crypt->createKeyPair();
         $this->keyManager->setRecoveryKey($password, $keyPair);
     }
     if ($keyManager->checkRecoveryPassword($password)) {
         $appConfig->setAppValue('encryption', 'recoveryAdminEnabled', 1);
         return true;
     }
     return false;
 }
Пример #2
0
 public function testSetRecoveryKey()
 {
     $this->keyStorageMock->expects($this->exactly(2))->method('setSystemUserKey')->willReturn(true);
     $this->cryptMock->expects($this->any())->method('encryptPrivateKey')->with($this->equalTo('privateKey'), $this->equalTo('pass'))->willReturn('decryptedPrivateKey');
     $this->assertTrue($this->instance->setRecoveryKey('pass', array('publicKey' => 'publicKey', 'privateKey' => 'privateKey')));
 }