]> source.dussan.org Git - nextcloud-server.git/commitdiff
always have a defined return value
authorBjörn Schießle <schiessle@owncloud.com>
Wed, 19 Jun 2013 14:55:31 +0000 (16:55 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Wed, 19 Jun 2013 14:55:31 +0000 (16:55 +0200)
apps/files_encryption/lib/crypt.php

index 3e5a97464d2a5d1d24a081e9029a3af50c112185..927064012b65de88b28d5538c8dfdb922c0a4a59 100755 (executable)
@@ -51,18 +51,18 @@ class Crypt {
         */\r
        public static function createKeypair() {\r
 \r
+               $return = false;\r
+\r
                $res = openssl_pkey_new(array('private_key_bits' => 4096));\r
 \r
                if ($res === false) {\r
                        \OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \OCP\Util::ERROR);\r
-                       $result = false;\r
                } elseif (openssl_pkey_export($res, $privateKey)) {\r
-\r
                        // Get public key\r
                        $publicKey = openssl_pkey_get_details($res);\r
                        $publicKey = $publicKey['key'];\r
 \r
-                       $result = array(\r
+                       $return = array(\r
                                'publicKey' => $publicKey,\r
                                'privateKey' => $privateKey\r
                        );\r
@@ -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);\r
                }\r
 \r
-               return $result;\r
+               return $return;\r
        }\r
 \r
        /**\r