]> source.dussan.org Git - nextcloud-server.git/commitdiff
decrypt private key for public shares correctly
authorBjoern Schiessle <schiessle@owncloud.com>
Wed, 15 Apr 2015 17:37:03 +0000 (19:37 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Thu, 16 Apr 2015 12:15:04 +0000 (14:15 +0200)
apps/encryption/lib/crypto/crypt.php
apps/encryption/lib/keymanager.php
apps/encryption/tests/lib/KeyManagerTest.php

index c026aa6a90a4a68cd0f14f2bde748503858c5456..9ada9200551246df9dae49b0e1a4ad915332f1c8 100644 (file)
@@ -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);
 
index a280ea9bde33558f7109fe808a2cad5fbc59db16..62970c141c5a0cfd2472362572127188b960e86e 100644 (file)
@@ -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();
index 1e51341a7e4919736e3a7b7e0fd733a84c5e2f75..251628d99f2e3659d88066c78e7d092d26e5d2fd 100644 (file)
@@ -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())