mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
decrypt private key for public shares correctly
This commit is contained in:
parent
b25c06f576
commit
959665003b
3 changed files with 4 additions and 4 deletions
|
|
@ -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…
Reference in a new issue