]> source.dussan.org Git - nextcloud-server.git/commitdiff
add openssl_error_string() output to the owncloud.log
authorBjörn Schießle <schiessle@owncloud.com>
Wed, 26 Jun 2013 13:51:22 +0000 (15:51 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Wed, 26 Jun 2013 13:51:22 +0000 (15:51 +0200)
apps/files_encryption/lib/crypt.php

index 927064012b65de88b28d5538c8dfdb922c0a4a59..6543a0de5f3b94b8a059e0bf01f1b1a32260041d 100755 (executable)
@@ -57,10 +57,11 @@ class Crypt {
 \r
                if ($res === false) {\r
                        \OCP\Util::writeLog('Encryption library', 'couldn\'t generate users key-pair for ' . \OCP\User::getUser(), \OCP\Util::ERROR);\r
+                       \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);\r
                } elseif (openssl_pkey_export($res, $privateKey)) {\r
                        // Get public key\r
-                       $publicKey = openssl_pkey_get_details($res);\r
-                       $publicKey = $publicKey['key'];\r
+                       $keyDetails = openssl_pkey_get_details($res);\r
+                       $publicKey = $keyDetails['key'];\r
 \r
                        $return = array(\r
                                'publicKey' => $publicKey,\r
@@ -68,6 +69,7 @@ class Crypt {
                        );\r
                } else {\r
                        \OCP\Util::writeLog('Encryption library', 'couldn\'t export users private key, please check your servers openSSL configuration.' . \OCP\User::getUser(), \OCP\Util::ERROR);\r
+                       \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);\r
                }\r
 \r
                return $return;\r
@@ -206,13 +208,10 @@ class Crypt {
        public static function encrypt($plainContent, $iv, $passphrase = '') {\r
 \r
                if ($encryptedContent = openssl_encrypt($plainContent, 'AES-128-CFB', $passphrase, false, $iv)) {\r
-\r
                        return $encryptedContent;\r
-\r
                } else {\r
-\r
                        \OCP\Util::writeLog('Encryption library', 'Encryption (symmetric) of content failed', \OCP\Util::ERROR);\r
-\r
+                       \OCP\Util::writeLog('Encryption library', openssl_error_string(), \OCP\Util::ERROR);\r
                        return false;\r
 \r
                }\r