From 8e5bc02e92340e8ee69ea40e79a7a0a16c7770b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Wed, 19 Jun 2013 16:55:31 +0200 Subject: [PATCH] always have a defined return value --- apps/files_encryption/lib/crypt.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; } /** -- 2.39.5