decrypt private key for public shares correctly

remotes/origin/poc-doctrine-migrations
Bjoern Schiessle 10 years ago
parent b25c06f576
commit 959665003b
  1. 4
      apps/encryption/lib/crypto/crypt.php
  2. 2
      apps/encryption/lib/keymanager.php
  3. 2
      apps/encryption/tests/lib/KeyManagerTest.php

@ -231,7 +231,7 @@ class Crypt {
* @param string $password
* @return bool|string
*/
public function decryptPrivateKey($privateKey, $password) {
public function decryptPrivateKey($privateKey, $password = '') {
$header = $this->parseHeader($privateKey);
@ -273,7 +273,7 @@ class Crypt {
* @return string
* @throws DecryptionFailedException
*/
public function symmetricDecryptFileContent($keyFileContents, $passPhrase = '', $cipher = self::DEFAULT_CIPHER) {
public function symmetricDecryptFileContent($keyFileContents, $passPhrase, $cipher = self::DEFAULT_CIPHER) {
// Remove Padding
$noPadding = $this->removePadding($keyFileContents);

@ -337,7 +337,7 @@ class KeyManager {
$uid = $this->getPublicShareKeyId();
$shareKey = $this->getShareKey($path, $uid);
$privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey');
$privateKey = $this->crypt->symmetricDecryptFileContent($privateKey);
$privateKey = $this->crypt->decryptPrivateKey($privateKey);
} else {
$shareKey = $this->getShareKey($path, $uid);
$privateKey = $this->session->getPrivateKey();

@ -268,7 +268,7 @@ class KeyManagerTest extends TestCase {
->willReturn(true);
$this->cryptMock->expects($this->once())
->method('symmetricDecryptFileContent')
->method('decryptPrivateKey')
->willReturn(true);
$this->cryptMock->expects($this->once())

Loading…
Cancel
Save