From: Björn Schießle Date: Wed, 19 Jun 2013 14:55:31 +0000 (+0200) Subject: always have a defined return value X-Git-Tag: v6.0.0alpha2~607^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe61230cc14b130bc553cf3270df8f3bd8b88d4d;p=nextcloud-server.git always have a defined return value --- diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index 3e5a97464d2..927064012b6 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -51,18 +51,18 @@ class Crypt { */ public static function createKeypair() { + $return = false; + $res = openssl_pkey_new(array('private_key_bits' => 4096)); if ($res === false) { \OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \OCP\Util::ERROR); - $result = false; } elseif (openssl_pkey_export($res, $privateKey)) { - // Get public key $publicKey = openssl_pkey_get_details($res); $publicKey = $publicKey['key']; - $result = array( + $return = array( 'publicKey' => $publicKey, 'privateKey' => $privateKey ); @@ -70,7 +70,7 @@ class Crypt { \OCP\Util::writeLog('Encryption library', 'couldn\'t export users private key, please check your servers openSSL configuration.' . \OCP\User::getUser(), \OCP\Util::ERROR); } - return $result; + return $return; } /**